Search in sources :

Example 11 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method testFilterContributorPrivateDataForWorkWithPublicName.

@Test
public void testFilterContributorPrivateDataForWorkWithPublicName() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
    when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
    when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn("a public name");
    Work work = getWorkWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(work);
    Contributor contributor = work.getWorkContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("a public name", contributor.getCreditName().getContent());
}
Also used : Work(org.orcid.jaxb.model.v3.dev1.record.Work) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Test(org.junit.Test)

Example 12 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method testFilterContributorPrivateDataForWorkWithInvalidOrcidRecord.

@Test
public void testFilterContributorPrivateDataForWorkWithInvalidOrcidRecord() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(false);
    Work work = getWorkWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(work);
    Contributor contributor = work.getWorkContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("original credit name", contributor.getCreditName().getContent());
}
Also used : Work(org.orcid.jaxb.model.v3.dev1.record.Work) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Contributor(org.orcid.jaxb.model.v3.dev1.common.Contributor) Test(org.junit.Test)

Example 13 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithPublicName.

@Test
public void testFilterContributorPrivateDataForFundingWithPublicName() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
    when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
    when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn("a public name");
    Funding funding = getFundingWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(funding);
    FundingContributor contributor = funding.getContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("a public name", contributor.getCreditName().getContent());
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Test(org.junit.Test)

Example 14 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getFundingWithContributorWithoutOrcid.

private Funding getFundingWithContributorWithoutOrcid() {
    Funding funding = new Funding();
    FundingTitle fundingTitle = new FundingTitle();
    fundingTitle.setTitle(new Title("funding with contributor without ORCID record"));
    funding.setTitle(fundingTitle);
    funding.setContributors(getFundingContributorWithoutOrcid());
    return funding;
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle)

Example 15 with Contributor

use of org.orcid.jaxb.model.v3.dev1.common.Contributor in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getFundingContributorWithOrcid.

private FundingContributors getFundingContributorWithOrcid() {
    ContributorOrcid contributorOrcid = new ContributorOrcid();
    contributorOrcid.setPath("0000-0003-4902-6327");
    contributorOrcid.setHost("orcid.org");
    contributorOrcid.setUri("http://orcid.org/0000-0003-4902-6327");
    FundingContributor contributor = new FundingContributor();
    contributor.setContributorOrcid(contributorOrcid);
    contributor.setContributorEmail(new ContributorEmail("never@show.this"));
    contributor.setCreditName(new CreditName("original credit name"));
    FundingContributors fundingContributors = new FundingContributors();
    fundingContributors.getContributor().add(contributor);
    return fundingContributors;
}
Also used : FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName) FundingContributors(org.orcid.jaxb.model.v3.dev1.record.FundingContributors) ContributorOrcid(org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid) ContributorEmail(org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)

Aggregations

FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)24 Work (org.orcid.jaxb.model.v3.dev1.record.Work)14 Contributor (org.orcid.jaxb.model.v3.dev1.common.Contributor)12 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)11 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)11 Test (org.junit.Test)10 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)10 Title (org.orcid.jaxb.model.v3.dev1.common.Title)9 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)9 ContributorOrcid (org.orcid.jaxb.model.v3.dev1.common.ContributorOrcid)8 FundingTitle (org.orcid.jaxb.model.v3.dev1.record.FundingTitle)7 ContributorEmail (org.orcid.jaxb.model.v3.dev1.common.ContributorEmail)6 WorkContributors (org.orcid.jaxb.model.v3.dev1.record.WorkContributors)6 ArrayList (java.util.ArrayList)5 Contributor (org.orcid.pojo.ajaxForm.Contributor)5 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)4 Url (org.orcid.jaxb.model.v3.dev1.common.Url)4 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)4 Amount (org.orcid.jaxb.model.v3.dev1.common.Amount)3 Country (org.orcid.jaxb.model.v3.dev1.common.Country)3