use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testName_ThrowException_When_TokenIsForOtherUser.
@Test(expected = OrcidUnauthorizedException.class)
public void testName_ThrowException_When_TokenIsForOtherUser() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_UPDATE);
Name name = createName(Visibility.PUBLIC);
orcidSecurityManager.checkAndFilter(ORCID_2, name, ScopePathType.ORCID_BIO_READ_LIMITED);
fail();
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPersonalDetails_When_AllPrivate_NoSource_ReadLimitedToken.
@Test
public void testPersonalDetails_When_AllPrivate_NoSource_ReadLimitedToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
Name name = createName(Visibility.PRIVATE);
Biography bio = createBiography(Visibility.PRIVATE);
OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherNames otherNames = new OtherNames();
otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
PersonalDetails p = new PersonalDetails();
p.setBiography(bio);
p.setName(name);
p.setOtherNames(otherNames);
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
assertNull(p.getName());
assertNull(p.getBiography());
assertNotNull(p.getOtherNames());
assertNotNull(p.getOtherNames().getOtherNames());
assertTrue(p.getOtherNames().getOtherNames().isEmpty());
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPersonalDetails_When_SomeLimited_NoSource_ReadLimitedToken.
@Test
public void testPersonalDetails_When_SomeLimited_NoSource_ReadLimitedToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
Name name = createName(Visibility.LIMITED);
Biography bio = createBiography(Visibility.LIMITED);
OtherName o1 = createOtherName(Visibility.PUBLIC, CLIENT_2);
OtherName o2 = createOtherName(Visibility.LIMITED, CLIENT_2);
OtherName o3 = createOtherName(Visibility.LIMITED, CLIENT_2);
OtherNames otherNames = new OtherNames();
otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
PersonalDetails p = new PersonalDetails();
p.setBiography(bio);
p.setName(name);
p.setOtherNames(otherNames);
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
assertEquals(name, p.getName());
assertEquals(bio, p.getBiography());
assertNotNull(p.getOtherNames());
assertNotNull(p.getOtherNames().getOtherNames());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertTrue(p.getOtherNames().getOtherNames().contains(o1));
assertTrue(p.getOtherNames().getOtherNames().contains(o2));
assertTrue(p.getOtherNames().getOtherNames().contains(o3));
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method getPeerReview.
private PeerReview getPeerReview(String extIdValue) {
PeerReview peerReview = new PeerReview();
peerReview.setRole(Role.CHAIR);
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("doi");
extId.setUrl(new Url("http://orcid.org"));
if (extIdValue == null) {
extId.setValue("ext-id-value");
} else {
extId.setValue("ext-id-value-" + extIdValue);
}
extIds.getExternalIdentifier().add(extId);
peerReview.setExternalIdentifiers(extIds);
if (extIdValue == null) {
peerReview.setSubjectContainerName(new Title("Peer review title"));
} else {
peerReview.setSubjectContainerName(new Title("Peer review title " + extIdValue));
}
peerReview.setSubjectExternalIdentifier(extId);
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);
peerReview.setOrganization(org);
peerReview.setType(PeerReviewType.EVALUATION);
peerReview.setVisibility(Visibility.PUBLIC);
return peerReview;
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class PersonDetailsManagerTest method testGetPersonDetails.
@Test
public void testGetPersonDetails() {
Person person = personDetailsManager.getPersonDetails(ORCID);
assertNotNull(person);
assertNotNull(person.getExternalIdentifiers());
assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers());
assertEquals(5, person.getExternalIdentifiers().getExternalIdentifiers().size());
assertNotNull(person.getResearcherUrls());
assertNotNull(person.getResearcherUrls().getResearcherUrls());
assertEquals(5, person.getResearcherUrls().getResearcherUrls().size());
assertNotNull(person.getOtherNames());
assertNotNull(person.getOtherNames().getOtherNames());
assertEquals(5, person.getOtherNames().getOtherNames().size());
assertNotNull(person.getAddresses());
assertNotNull(person.getAddresses().getAddress());
assertEquals(5, person.getAddresses().getAddress().size());
assertNotNull(person.getKeywords());
assertNotNull(person.getKeywords().getKeywords());
assertEquals(5, person.getKeywords().getKeywords().size());
assertNotNull(person.getEmails());
assertNotNull(person.getEmails().getEmails());
assertEquals(5, person.getEmails().getEmails().size());
assertNotNull(person.getBiography());
assertEquals(Visibility.PUBLIC, person.getBiography().getVisibility());
assertEquals("Biography for 0000-0000-0000-0003", person.getBiography().getContent());
assertNotNull(person.getName());
assertNotNull(person.getName().getCreditName());
assertEquals("Credit Name", person.getName().getCreditName().getContent());
assertNotNull(person.getName().getFamilyName());
assertEquals("Family Name", person.getName().getFamilyName().getContent());
assertNotNull(person.getName().getGivenNames());
assertEquals("Given Names", person.getName().getGivenNames().getContent());
assertEquals(Visibility.PUBLIC, person.getName().getVisibility());
}
Aggregations