Skip to content

Commit

Permalink
Adding more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Aug 3, 2023
1 parent 3138b77 commit 82573a4
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 32 deletions.
16 changes: 8 additions & 8 deletions orcid-test/src/main/resources/data/ClientDetailsEntityData.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version='1.0' encoding='UTF-8'?>
<dataset>

<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4441" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="S. Milligan" client_description="Terence Alan Patrick Seán 'Spike' Milligan KBE (16 April 1918 – 27 February 2002) was a comedian, writer, musician, poet, playwright, soldier and actor." client_website="www.4444-4444-4444-4441.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4442" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="T. Edison" client_description="" client_website="www.4444-4444-4444-4442.com" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4443" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="P. Sellers III" client_description="Richard Henry Sellers, CBE (8 September 1925 – 24 July 1980), known as Peter Sellers, was a British film actor, comedian and singer." client_website="www.4444-4444-4444-4443.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4444" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="H. Secombe" client_description="Sir Harry Donald Secombe, CBE (8 September 1921 – 11 April 2001) was a Welsh entertainer with a talent for comedy and a noted fine tenor singing voice." client_website="www.4444-4444-4444-4444.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4445" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="A. Timothy" client_description="Andrew Timothy (1912–9 December 1990) was an Anglican priest and BBC Radio announcer, who is best remembered for being the original announcer of the comedy series The Goon Show." client_website="www.4444-4444-4444-4445.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4498" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2014-07-14" last_modified="2014-07-14" client_name="U. Test" client_description="Client used to test the public OAuth process." client_website="www.4444-4444-4444-4498.com" persistent_tokens_enabled="false" group_orcid="4444-4444-4444-4441" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-6666666666666666" date_created="2012-04-25" last_modified="2012-04-25" client_name="Source Client 2" client_description="A test source client" client_website="www.6666666666666666.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-1234567898765432" date_created="2019-05-13" last_modified="2019-05-13" client_name="ORCID source" client_description="ORCID source for issn record" client_website="orcid.org" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4441" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="S. Milligan" client_description="Terence Alan Patrick Seán 'Spike' Milligan KBE (16 April 1918 – 27 February 2002) was a comedian, writer, musician, poet, playwright, soldier and actor." client_website="www.4444-4444-4444-4441.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false" user_obo_enabled="false" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4442" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="T. Edison" client_description="" client_website="www.4444-4444-4444-4442.com" persistent_tokens_enabled="false" user_obo_enabled="false" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4443" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="P. Sellers III" client_description="Richard Henry Sellers, CBE (8 September 1925 – 24 July 1980), known as Peter Sellers, was a British film actor, comedian and singer." client_website="www.4444-4444-4444-4443.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true" user_obo_enabled="false" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4444" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="H. Secombe" client_description="Sir Harry Donald Secombe, CBE (8 September 1921 – 11 April 2001) was a Welsh entertainer with a talent for comedy and a noted fine tenor singing voice." client_website="www.4444-4444-4444-4444.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false" user_obo_enabled="false" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4445" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="A. Timothy" client_description="Andrew Timothy (1912–9 December 1990) was an Anglican priest and BBC Radio announcer, who is best remembered for being the original announcer of the comedy series The Goon Show." client_website="www.4444-4444-4444-4445.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true" user_obo_enabled="false" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4498" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2014-07-14" last_modified="2014-07-14" client_name="U. Test" client_description="Client used to test the public OAuth process." client_website="www.4444-4444-4444-4498.com" persistent_tokens_enabled="false" group_orcid="4444-4444-4444-4441" user_obo_enabled="false" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-6666666666666666" date_created="2012-04-25" last_modified="2012-04-25" client_name="Source Client 2" client_description="A test source client" client_website="www.6666666666666666.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" user_obo_enabled="false" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-1234567898765432" date_created="2019-05-13" last_modified="2019-05-13" client_name="ORCID source" client_description="ORCID source for issn record" client_website="orcid.org" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" user_obo_enabled="false" />

<client_authorised_grant_type client_details_id="APP-6666666666666666" grant_type="authorization_code" />
<client_authorised_grant_type client_details_id="APP-6666666666666666" grant_type="client_credentials" />
Expand Down
31 changes: 28 additions & 3 deletions orcid-test/src/main/resources/data/ProfileEntityData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -714,9 +714,34 @@
last_modified="2011-07-02 15:31:00.00"
display_index="4"
/>

<external_identifier
id="18"
external_id_reference="self_public_ref"
external_id_type="self_public_type"
orcid="0000-0000-0000-0003"
external_id_url="http://ext-id/self/public"
source_id="0000-0000-0000-0003"
visibility="PUBLIC"
date_created="2011-06-29 15:32:00.00"
last_modified="2011-07-02 15:31:00.00"
display_index="5"
/>

<external_identifier
id="19"
external_id_reference="self_public_user_obo_ref"
external_id_type="self_public_user_obo_type"
orcid="0000-0000-0000-0003"
external_id_url="http://ext-id/self/obo/public"
client_source_id="APP-5555555555555558"
visibility="PUBLIC"
date_created="2011-06-29 15:32:00.00"
last_modified="2011-07-02 15:31:00.00"
display_index="6"
/>

<external_identifier
id="20"
external_id_reference="public"
external_id_type="public"
orcid="0000-0000-0000-0001"
Expand All @@ -729,7 +754,7 @@
/>

<external_identifier
id="19"
id="21"
external_id_reference="limited"
external_id_type="limited"
orcid="0000-0000-0000-0001"
Expand All @@ -742,7 +767,7 @@
/>

<external_identifier
id="20"
id="22"
external_id_reference="private"
external_id_type="private"
orcid="0000-0000-0000-0001"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
source_id="5555-5555-5555-5558"
/>

<client_details client_details_id="APP-5555555555555555" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 1" client_description="A test source client" client_website="www.5555555555555555.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="true" />
<client_details client_details_id="APP-5555555555555556" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 2" client_description="A test source client" client_website="www.5555555555555556.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="false" />
<client_details client_details_id="APP-5555555555555557" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 3" client_description="A test source client" client_website="www.5555555555555557.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="true" />
<client_details client_details_id="APP-5555555555555558" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 4" client_description="A test source client" client_website="www.5555555555555558.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="true" />
<client_details client_details_id="APP-5555555555555555" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 1" client_description="A test source client" client_website="www.5555555555555555.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="true" user_obo_enabled="false" />
<client_details client_details_id="APP-5555555555555556" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 2" client_description="A test source client" client_website="www.5555555555555556.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="false" user_obo_enabled="false" />
<client_details client_details_id="APP-5555555555555557" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 3" client_description="A test source client" client_website="www.5555555555555557.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="true" user_obo_enabled="false" />
<client_details client_details_id="APP-5555555555555558" date_created="2012-04-25" last_modified="2012-04-25" client_type="PREMIUM_CREATOR" client_name="Source Client 4" client_description="A test source client" client_website="www.5555555555555558.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true" allow_auto_deprecate="true" user_obo_enabled="true" />

<client_authorised_grant_type client_details_id="APP-5555555555555555" grant_type="authorization_code" />
<client_authorised_grant_type client_details_id="APP-5555555555555555" grant_type="client_credentials" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand All @@ -132,19 +142,33 @@ public void testGetPublicRecord() {
public void testGetRecordSummary() {
RecordSummary record = publicRecordController.getSummaryRecord(userOrcid);

assertEquals("active", record.getStatus());
assertNotNull(record.getName());
assertEquals("Credit Name", record.getName());

assertNotNull(record.getEmploymentAffiliations());
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());

Expand All @@ -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
Expand Down

0 comments on commit 82573a4

Please sign in to comment.