use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testUpdateWorkWhenNotSource.
@Test(expected = WrongSourceException.class)
@Transactional
public void testUpdateWorkWhenNotSource() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.ORCID_WORKS_UPDATE);
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-4446"));
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
OrcidWorks orcidWorks = new OrcidWorks();
orcidActivities.setOrcidWorks(orcidWorks);
OrcidWork orcidWork = new OrcidWork();
orcidWorks.getOrcidWork().add(orcidWork);
orcidWork.setPutCode("6");
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title("Updated by works update"));
orcidWork.setWorkTitle(workTitle);
orcidWork.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
WorkExternalIdentifiers workExternalIdentifiers = new WorkExternalIdentifiers();
WorkExternalIdentifier wei = new WorkExternalIdentifier();
wei.setWorkExternalIdentifierType(WorkExternalIdentifierType.DOI);
wei.setWorkExternalIdentifierId(new WorkExternalIdentifierId("abc123"));
workExternalIdentifiers.getWorkExternalIdentifier().add(wei);
orcidWork.setWorkExternalIdentifiers(workExternalIdentifiers);
t2OrcidApiServiceDelegator.updateWorks(mockedUriInfo, "4444-4444-4444-4446", orcidMessage);
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method createStubOrcidMessage.
private OrcidMessage createStubOrcidMessage() {
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
OrcidBio orcidBio = new OrcidBio();
orcidProfile.setOrcidBio(orcidBio);
PersonalDetails personalDetails = new PersonalDetails();
orcidBio.setPersonalDetails(personalDetails);
GivenNames givenNames = new GivenNames("Test given names");
personalDetails.setGivenNames(givenNames);
CreditName creditName = new CreditName("Test credit name");
personalDetails.setCreditName(creditName);
creditName.setVisibility(Visibility.LIMITED);
ContactDetails contactDetails = new ContactDetails();
orcidBio.setContactDetails(contactDetails);
return orcidMessage;
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testAddExternalIdentifiersToDeprecatedAccount.
@Test(expected = OrcidDeprecatedException.class)
public void testAddExternalIdentifiersToDeprecatedAccount() {
SecurityContextTestUtils.setUpSecurityContext();
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
orcidMessage.setOrcidProfile(new OrcidProfile());
orcidMessage.getOrcidProfile().setOrcidBio(new OrcidBio());
ExternalIdentifiers extIds = new ExternalIdentifiers();
ExternalIdentifier extId1 = new ExternalIdentifier();
String commonName = "common-name-1-" + System.currentTimeMillis();
extId1.setExternalIdCommonName(new ExternalIdCommonName(commonName));
extId1.setExternalIdReference(new ExternalIdReference("ext-id-reference-1"));
extId1.setExternalIdUrl(new ExternalIdUrl("http://test.orcid.org/" + System.currentTimeMillis()));
extIds.getExternalIdentifier().add(extId1);
orcidMessage.getOrcidProfile().getOrcidBio().setExternalIdentifiers(extIds);
t2OrcidApiServiceDelegator.addExternalIdentifiers(mockedUriInfo, "4444-4444-4444-444X", orcidMessage);
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testAddFundingToDeprecatedAccount.
@Test(expected = OrcidDeprecatedException.class)
public void testAddFundingToDeprecatedAccount() {
SecurityContextTestUtils.setUpSecurityContext();
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
orcidMessage.setOrcidProfile(orcidProfile);
orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-444X"));
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
FundingList fundings = new FundingList();
Funding funding = new Funding();
OrganizationAddress address = new OrganizationAddress();
address.setCity("City");
address.setCountry(Iso3166Country.US);
Organization org = new Organization();
org.setAddress(address);
org.setName("Testing org name");
funding.setOrganization(org);
FundingExternalIdentifiers fExtIds = new FundingExternalIdentifiers();
FundingExternalIdentifier fExtId = new FundingExternalIdentifier();
fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER);
fExtId.setValue("FExtId");
fExtIds.getFundingExternalIdentifier().add(fExtId);
funding.setFundingExternalIdentifiers(fExtIds);
funding.setType(FundingType.AWARD);
funding.setOrganizationDefinedFundingType(new OrganizationDefinedFundingSubType("fType"));
FundingTitle title = new FundingTitle();
title.setTitle(new Title("Funding title"));
funding.setTitle(title);
fundings.getFundings().add(funding);
orcidActivities.setFundings(fundings);
t2OrcidApiServiceDelegator.addFunding(mockedUriInfo, "4444-4444-4444-444X", orcidMessage);
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testReadPrivacyOnBio.
@Test
public void testReadPrivacyOnBio() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4497", ScopePathType.READ_LIMITED);
/*Example A List on 4444-4444-4444-4497:
Item 1 Private (client is source)
Item 2 Private (other source)
Item 3 Limited
Item 4 Public
*/
OrcidProfile p = ((OrcidMessage) t2OrcidApiServiceDelegator.findBioDetails("4444-4444-4444-4497").getEntity()).getOrcidProfile();
assertEquals(3, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("type2", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
assertEquals(Visibility.PRIVATE, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getVisibility());
assertEquals("type3", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(1).getExternalIdCommonName().getContent());
assertEquals(Visibility.LIMITED, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(1).getVisibility());
assertEquals("type4", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(2).getExternalIdCommonName().getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(2).getVisibility());
assertEquals(Visibility.PRIVATE, p.getOrcidBio().getExternalIdentifiers().getVisibility());
}
Aggregations