use of org.orcid.jaxb.model.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateDuplicatedExtIds_noDuplicatesTest.
/**
* VALIDATE DUPLICATED EXTERNAL IDENTIFIERS
*/
@SuppressWarnings("deprecation")
@Test
public void validateDuplicatedExtIds_noDuplicatesTest() {
SourceEntity source1 = mock(SourceEntity.class);
when(source1.getSourceName()).thenReturn("source name");
when(source1.getSourceId()).thenReturn("APP-00000000000000");
SourceOrcid sourceOrcid = new SourceOrcid();
sourceOrcid.setPath("0000-0000-0000-0000");
Source source2 = mock(Source.class);
when(source2.getSourceName()).thenReturn(new SourceName("other source name"));
when(source2.getSourceOrcid()).thenReturn(sourceOrcid);
ExternalIDs extIds1 = getExternalIDs();
ExternalIDs extIds2 = getExternalIDs();
activityValidator.checkExternalIdentifiersForDuplicates(extIds1, extIds2, source2, source1);
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method getFunding.
private Funding getFunding(String grantNumber) {
Funding funding = new Funding();
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("grant_number");
extId.setUrl(new Url("http://orcid.org"));
if (grantNumber == null) {
extId.setValue("ext-id-value");
} else {
extId.setValue(grantNumber);
}
extIds.getExternalIdentifier().add(extId);
funding.setExternalIdentifiers(extIds);
FundingTitle title = new FundingTitle();
if (grantNumber == null) {
title.setTitle(new Title("Funding title"));
} else {
title.setTitle(new Title("Funding title " + grantNumber));
}
funding.setTitle(title);
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
disambiguatedOrg.setDisambiguationSource("WDB");
org.setDisambiguatedOrganization(disambiguatedOrg);
funding.setOrganization(org);
funding.setVisibility(Visibility.PUBLIC);
funding.setType(FundingType.AWARD);
return funding;
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method getFundingSummary.
private FundingSummary getFundingSummary(String titleValue, String extIdValue, Visibility visibility) {
FundingSummary summary = new FundingSummary();
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title(titleValue));
summary.setTitle(fundingTitle);
summary.setVisibility(visibility);
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("doi");
extId.setUrl(new Url("http://orcid.org"));
extId.setValue(extIdValue);
extIds.getExternalIdentifier().add(extId);
summary.setExternalIdentifiers(extIds);
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
summary.setOrganization(org);
return summary;
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class ExternalIDValidatorTest method testEmptyRelationshipOnFundingExternalIds_flagOn.
@Test(expected = ActivityIdentifierValidationException.class)
public void testEmptyRelationshipOnFundingExternalIds_flagOn() {
validator.setRequireRelationshipOnExternalIdentifier(true);
ExternalID id1 = new ExternalID();
id1.setRelationship(null);
id1.setType("grant_number");
id1.setValue("value1");
id1.setUrl(new Url("http://value1.com"));
ExternalIDs ids = new ExternalIDs();
ids.getExternalIdentifier().add(id1);
validator.validateFunding(ids);
fail("no exception thrown for invalid type");
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class ExternalIDValidatorTest method testEmptyRelationshipOnFundingExternalIds_flagOff.
@Test
public void testEmptyRelationshipOnFundingExternalIds_flagOff() {
ExternalID id1 = new ExternalID();
id1.setRelationship(null);
id1.setType("grant_number");
id1.setValue("value1");
id1.setUrl(new Url("http://value1.com"));
ExternalIDs ids = new ExternalIDs();
ids.getExternalIdentifier().add(id1);
validator.validateFunding(ids);
}
Aggregations