-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add professional email source name to api responses (#7142)
* add professional email source name to api responses * add null check * update tests * refactor * update tests * fix tests * fix more tests * refactor * fix issues * add assertions * fix tests * fix more tests * test fix * fix more tests * actually fix the test * more test fixes * more tests * fix test * add null check and refactor for readability * fix more tests * more tests * more tests * more tests
- Loading branch information
Showing
28 changed files
with
476 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,10 +88,12 @@ public void testReadPublicScope_Emails() { | |
assertNotNull(email); | ||
assertEquals("/0000-0000-0000-0003/email", email.getPath()); | ||
Utils.verifyLastModified(email.getLastModifiedDate()); | ||
assertEquals(3, email.getEmails().size()); | ||
assertEquals(4, email.getEmails().size()); | ||
boolean found1 = false; | ||
boolean found2 = false; | ||
boolean found3 = false; | ||
boolean found4 = false; | ||
|
||
for (Email element : email.getEmails()) { | ||
Utils.verifyLastModified(element.getLastModifiedDate()); | ||
if (element.getEmail().equals("[email protected]")) { | ||
|
@@ -100,14 +102,18 @@ public void testReadPublicScope_Emails() { | |
found2 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found3 = true; | ||
} else { | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found4 = true; | ||
} | ||
else { | ||
fail("Invalid put code " + element.getPutCode()); | ||
} | ||
|
||
} | ||
assertTrue(found1); | ||
assertTrue(found2); | ||
assertTrue(found3); | ||
assertTrue(found4); | ||
} | ||
|
||
@Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,7 @@ public void testViewPerson() { | |
Emails email = p.getEmails(); | ||
assertNotNull(email); | ||
Utils.verifyLastModified(email.getLastModifiedDate()); | ||
assertEquals(4, email.getEmails().size()); | ||
assertEquals(5, email.getEmails().size()); | ||
|
||
found1 = false; | ||
found2 = false; | ||
|
@@ -164,6 +164,8 @@ public void testViewPerson() { | |
found3 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found4 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found5 = true; | ||
} else { | ||
fail("Invalid email " + element.getEmail()); | ||
} | ||
|
@@ -173,6 +175,7 @@ public void testViewPerson() { | |
assertTrue(found2); | ||
assertTrue(found3); | ||
assertTrue(found4); | ||
assertTrue(found5); | ||
|
||
// External identifiers | ||
assertNotNull(p.getExternalIdentifiers()); | ||
|
@@ -356,12 +359,14 @@ private void testPerson(Person p, String orcid) { | |
Emails email = p.getEmails(); | ||
assertNotNull(email); | ||
Utils.verifyLastModified(email.getLastModifiedDate()); | ||
assertEquals(3, email.getEmails().size()); | ||
assertEquals(4, email.getEmails().size()); | ||
assertEquals("[email protected]", email.getEmails().get(0).getEmail()); | ||
assertEquals("[email protected]", email.getEmails().get(1).getEmail()); | ||
|
||
found1 = false; | ||
found2 = false; | ||
found3 = false; | ||
found4 = false; | ||
|
||
for (Email element : email.getEmails()) { | ||
if (element.getEmail().equals("[email protected]")) { | ||
|
@@ -370,6 +375,8 @@ private void testPerson(Person p, String orcid) { | |
found2 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found3 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found4 = true; | ||
} else { | ||
fail("Invalid email " + element.getEmail()); | ||
} | ||
|
@@ -378,6 +385,7 @@ private void testPerson(Person p, String orcid) { | |
assertTrue(found1); | ||
assertTrue(found2); | ||
assertTrue(found3); | ||
assertTrue(found4); | ||
|
||
// External identifiers | ||
assertNotNull(p.getExternalIdentifiers()); | ||
|
@@ -514,9 +522,9 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { | |
Emails email = p.getEmails(); | ||
assertNotNull(email); | ||
Utils.verifyLastModified(email.getLastModifiedDate()); | ||
assertEquals(4, email.getEmails().size()); | ||
assertEquals(5, email.getEmails().size()); | ||
|
||
boolean found1 = false, found2 = false, found3 = false, found4 = false; | ||
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; | ||
|
||
for (Email element : email.getEmails()) { | ||
if (element.getEmail().equals("[email protected]")) { | ||
|
@@ -527,6 +535,8 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { | |
found3 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found4 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found5 = true; | ||
} else { | ||
fail("Invalid email " + element.getEmail()); | ||
} | ||
|
@@ -536,6 +546,7 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { | |
assertTrue(found2); | ||
assertTrue(found3); | ||
assertTrue(found4); | ||
assertTrue(found5); | ||
this.assertAllPublicButEmails(p); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,34 @@ 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("[email protected]")) { | ||
assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); | ||
assertEquals(Visibility.PUBLIC.value(), email.getVisibility().value()); | ||
assertNull(email.getSource().getSourceOrcid()); | ||
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC.value(), email.getVisibility().value()); | ||
assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); | ||
} else if (email.getEmail().equals("[email protected]")) { | ||
assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); | ||
assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); | ||
assertNull(email.getSource().getSourceOrcid()); | ||
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED.value(), email.getVisibility().value()); | ||
assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); | ||
} else if (email.getEmail().equals("[email protected]")) { | ||
assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); | ||
assertEquals(Visibility.PRIVATE.value(), email.getVisibility().value()); | ||
assertNull(email.getSource().getSourceOrcid()); | ||
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE.value(), email.getVisibility().value()); | ||
assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); | ||
} else if (email.getEmail().equals("[email protected]")) { | ||
assertEquals("0000-0000-0000-0003", email.getSource().retrieveSourcePath()); | ||
assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); | ||
assertNotNull(email.getSource().getSourceOrcid()); | ||
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED.value(), email.getVisibility().value()); | ||
assertEquals("Credit Name", email.getSource().getSourceName().getContent()); | ||
} else if (email.getEmail().equals("[email protected]")) { | ||
assertEquals("0000-0000-0000-0000", email.getSource().retrieveSourcePath()); | ||
assertNull(email.getSource().getSourceOrcid()); | ||
assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC.value(), email.getVisibility().value()); | ||
assertEquals("ORCID email validation", email.getSource().getSourceName().getContent()); | ||
} else { | ||
fail("Invalid email found: " + email.getEmail()); | ||
} | ||
|
@@ -842,12 +855,13 @@ private void testPerson(Person p, String orcid) { | |
Emails email = p.getEmails(); | ||
assertNotNull(email); | ||
Utils.verifyLastModified(email.getLastModifiedDate()); | ||
assertEquals(3, email.getEmails().size()); | ||
assertEquals(4, email.getEmails().size()); | ||
assertEquals("[email protected]", email.getEmails().get(0).getEmail()); | ||
|
||
found1 = false; | ||
found2 = false; | ||
found3 = false; | ||
found4 = false; | ||
|
||
for (Email element : email.getEmails()) { | ||
if (element.getEmail().equals("[email protected]")) { | ||
|
@@ -856,6 +870,8 @@ private void testPerson(Person p, String orcid) { | |
found2 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found3 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found4 = true; | ||
} else { | ||
fail("Invalid email " + element.getEmail()); | ||
} | ||
|
@@ -864,6 +880,7 @@ private void testPerson(Person p, String orcid) { | |
assertTrue(found1); | ||
assertTrue(found2); | ||
assertTrue(found3); | ||
assertTrue(found4); | ||
|
||
// External identifiers | ||
assertNotNull(p.getExternalIdentifiers()); | ||
|
@@ -1004,9 +1021,9 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { | |
Emails email = p.getEmails(); | ||
assertNotNull(email); | ||
Utils.verifyLastModified(email.getLastModifiedDate()); | ||
assertEquals(4, email.getEmails().size()); | ||
assertEquals(5, email.getEmails().size()); | ||
|
||
boolean found1 = false, found2 = false, found3 = false, found4 = false; | ||
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; | ||
|
||
for (Email element : email.getEmails()) { | ||
if (element.getEmail().equals("[email protected]")) { | ||
|
@@ -1017,6 +1034,8 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { | |
found3 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found4 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found5 = true; | ||
} else { | ||
fail("Invalid email " + element.getEmail()); | ||
} | ||
|
@@ -1026,6 +1045,8 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { | |
assertTrue(found2); | ||
assertTrue(found3); | ||
assertTrue(found4); | ||
assertTrue(found5); | ||
|
||
|
||
this.assertAllPublicButEmails(p); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,10 +99,11 @@ public void testReadPublicScope_Emails() { | |
assertNotNull(email); | ||
assertEquals("/0000-0000-0000-0003/email", email.getPath()); | ||
Utils.verifyLastModified(email.getLastModifiedDate()); | ||
assertEquals(3, email.getEmails().size()); | ||
assertEquals(4, email.getEmails().size()); | ||
boolean found1 = false; | ||
boolean found2 = false; | ||
boolean found3 = false; | ||
boolean found4 = false; | ||
for (Email element : email.getEmails()) { | ||
Utils.verifyLastModified(element.getLastModifiedDate()); | ||
if (element.getEmail().equals("[email protected]")) { | ||
|
@@ -111,6 +112,8 @@ public void testReadPublicScope_Emails() { | |
found2 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found3 = true; | ||
} else if (element.getEmail().equals("[email protected]")) { | ||
found4 = true; | ||
} else { | ||
fail("Invalid put code " + element.getPutCode()); | ||
} | ||
|
@@ -119,6 +122,7 @@ public void testReadPublicScope_Emails() { | |
assertTrue(found1); | ||
assertTrue(found2); | ||
assertTrue(found3); | ||
assertTrue(found4); | ||
} | ||
|
||
@Test | ||
|
Oops, something went wrong.