use of org.orcid.jaxb.model.message.ResearcherUrls in project ORCID-Source by ORCID.
the class OrcidProfileManagerBaseTest method createFullOrcidProfile.
protected OrcidProfile createFullOrcidProfile() {
OrcidProfile profile2 = new OrcidProfile();
profile2.setPassword("password");
profile2.setVerificationCode("1234");
profile2.setOrcidIdentifier(TEST_ORCID);
OrcidBio bio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
contactDetails.addOrReplacePrimaryEmail(new Email("will@orcid.org"));
bio.setContactDetails(contactDetails);
profile2.setOrcidBio(bio);
PersonalDetails personalDetails = new PersonalDetails();
personalDetails.setGivenNames(new GivenNames("William"));
personalDetails.setFamilyName(new FamilyName("Simpson"));
personalDetails.setCreditName(new CreditName("W. J. R. Simpson"));
bio.setPersonalDetails(personalDetails);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.getResearcherUrl().add(new ResearcherUrl(new Url("http://www.wjrs.co.uk"), null));
bio.setResearcherUrls(researcherUrls);
Keywords keywords = new Keywords();
bio.setKeywords(keywords);
keywords.getKeyword().add(new Keyword("Java", null));
bio.setBiography(new Biography("Will is a software developer at Semantico"));
return profile2;
}
use of org.orcid.jaxb.model.message.ResearcherUrls in project ORCID-Source by ORCID.
the class JpaJaxbEntityAdapterToOrcidProfileTest method checkOrcidProfile.
private void checkOrcidProfile(OrcidBio orcidBio) {
checkPersonalDetails(orcidBio.getPersonalDetails());
assertNotNull(orcidBio.getContactDetails());
checkContactDetails(orcidBio.getContactDetails());
assertNotNull(orcidBio.getExternalIdentifiers());
checkExternalIdentifiers(orcidBio.getExternalIdentifiers());
assertNotNull(orcidBio.getDelegation());
checkDelegation(orcidBio.getDelegation());
assertNull(orcidBio.getScope());
// Applications are not linked with OrcidProfile object anymore.
// assertNotNull(orcidBio.getApplications());
// checkApplications(orcidBio.getApplications());
ResearcherUrls researcherUrls = orcidBio.getResearcherUrls();
List<ResearcherUrl> urls = researcherUrls.getResearcherUrl();
Collections.sort(urls);
assertEquals(6, urls.size());
Url url1 = urls.get(0).getUrl();
String url1Name = urls.get(0).getUrlName().getContent();
assertEquals(url1Name, "443_1");
assertEquals("http://www.researcherurl2.com?id=1", url1.getValue());
Url url2 = urls.get(1).getUrl();
String url2Name = urls.get(1).getUrlName().getContent();
assertEquals(url2Name, "443_2");
assertEquals("http://www.researcherurl2.com?id=2", url2.getValue());
Url url3 = urls.get(2).getUrl();
String url3Name = urls.get(2).getUrlName().getContent();
assertEquals(url3Name, "443_3");
assertEquals("http://www.researcherurl2.com?id=5", url3.getValue());
Url url4 = urls.get(3).getUrl();
String url4Name = urls.get(3).getUrlName().getContent();
assertEquals(url4Name, "443_4");
assertEquals("http://www.researcherurl2.com?id=6", url4.getValue());
Url url5 = urls.get(4).getUrl();
String url5Name = urls.get(4).getUrlName().getContent();
assertEquals(url5Name, "443_5");
assertEquals("http://www.researcherurl2.com?id=7", url5.getValue());
Url url6 = urls.get(5).getUrl();
String url6Name = urls.get(5).getUrlName().getContent();
assertEquals(url6Name, "443_6");
assertEquals("http://www.researcherurl2.com?id=8", url6.getValue());
checkKeywords(orcidBio.getKeywords());
}
use of org.orcid.jaxb.model.message.ResearcherUrls in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testDefaultPrivacyOnBio.
@Test
public void testDefaultPrivacyOnBio() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4499", ScopePathType.ORCID_BIO_UPDATE);
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-4499"));
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("Credit Name");
personalDetails.setCreditName(creditName);
ExternalIdentifier id = new ExternalIdentifier();
id.setExternalIdCommonName(new ExternalIdCommonName("cn1"));
id.setExternalIdReference(new ExternalIdReference("value1"));
orcidBio.setExternalIdentifiers(new ExternalIdentifiers());
orcidBio.getExternalIdentifiers().getExternalIdentifier().add(id);
personalDetails.setOtherNames(new OtherNames());
personalDetails.getOtherNames().addOtherName("on1", null);
orcidBio.setKeywords(new Keywords());
orcidBio.getKeywords().getKeyword().add(new Keyword("kw1", null));
orcidBio.setResearcherUrls(new ResearcherUrls());
orcidBio.getResearcherUrls().getResearcherUrl().add(new ResearcherUrl(new Url("http://rurl2.com"), null));
t2OrcidApiServiceDelegator.updateBioDetails(mockedUriInfo, "4444-4444-4444-4499", orcidMessage);
OrcidProfile p = orcidProfileManager.retrieveOrcidProfile("4444-4444-4444-4499");
assertEquals("cn1", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getVisibility());
assertEquals("on1", p.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
assertEquals("kw1", p.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getKeywords().getVisibility());
assertEquals(new Url("http://rurl2.com"), p.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getResearcherUrls().getVisibility());
// now test what happens if we add a new one.
}
Aggregations