use of org.orcid.jaxb.model.v3.dev1.record.PersonalDetails in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testFindPersonalDetails.
@Test
public void testFindPersonalDetails() {
Response response = serviceDelegator.viewPersonalDetails(ORCID);
assertNotNull(response);
PersonalDetails personalDetails = (PersonalDetails) response.getEntity();
assertNotNull(personalDetails);
assertNotNull(personalDetails.getLastModifiedDate());
assertNotNull(personalDetails.getLastModifiedDate().getValue());
assertNotNull(personalDetails.getBiography());
assertNotNull(personalDetails.getBiography().getLastModifiedDate());
assertNotNull(personalDetails.getBiography().getLastModifiedDate().getValue());
assertEquals("Biography for 0000-0000-0000-0003", personalDetails.getBiography().getContent());
assertEquals(Visibility.PUBLIC.value(), personalDetails.getBiography().getVisibility().value());
assertEquals("/0000-0000-0000-0003/biography", personalDetails.getBiography().getPath());
assertNotNull(personalDetails.getLastModifiedDate());
assertNotNull(personalDetails.getLastModifiedDate().getValue());
assertNotNull(personalDetails.getName());
assertNotNull(personalDetails.getName().getCreatedDate().getValue());
assertEquals("Credit Name", personalDetails.getName().getCreditName().getContent());
assertEquals("Family Name", personalDetails.getName().getFamilyName().getContent());
assertEquals("Given Names", personalDetails.getName().getGivenNames().getContent());
assertEquals(Visibility.PUBLIC.value(), personalDetails.getName().getVisibility().value());
assertNotNull(personalDetails.getName().getLastModifiedDate());
assertNotNull(personalDetails.getName().getLastModifiedDate().getValue());
assertNotNull(personalDetails.getOtherNames());
assertNotNull(personalDetails.getOtherNames().getLastModifiedDate());
assertNotNull(personalDetails.getOtherNames().getLastModifiedDate().getValue());
assertEquals(1, personalDetails.getOtherNames().getOtherNames().size());
assertEquals("Other Name PUBLIC", personalDetails.getOtherNames().getOtherNames().get(0).getContent());
assertEquals(Visibility.PUBLIC.value(), personalDetails.getOtherNames().getOtherNames().get(0).getVisibility().value());
assertEquals("/0000-0000-0000-0003/other-names", personalDetails.getOtherNames().getPath());
assertEquals("/0000-0000-0000-0003/personal-details", personalDetails.getPath());
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonalDetails in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorImpl method viewPersonalDetails.
@Override
public Response viewPersonalDetails(String orcid) {
PersonalDetails personalDetails = personalDetailsManagerReadOnly.getPublicPersonalDetails(orcid);
publicAPISecurityManagerV3.filter(personalDetails);
ElementUtils.setPathToPersonalDetails(personalDetails, orcid);
Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(personalDetails);
sourceUtilsReadOnly.setSourceName(personalDetails);
return Response.ok(personalDetails).build();
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPersonalDetails_When_ReadLimitedToken_EmptyElement.
@Test
public void testPersonalDetails_When_ReadLimitedToken_EmptyElement() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
PersonalDetails p = new PersonalDetails();
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPublicClient_checkAndFilter_PersonalDetails.
@Test(expected = OrcidUnauthorizedException.class)
public void testPublicClient_checkAndFilter_PersonalDetails() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, PUBLIC_CLIENT, ScopePathType.READ_PUBLIC);
orcidSecurityManager.checkAndFilter(ORCID_1, new PersonalDetails());
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPersonalDetails_When_TokenForOtherUser.
// ---- PERSONAL DETAILS ----
@Test(expected = OrcidUnauthorizedException.class)
public void testPersonalDetails_When_TokenForOtherUser() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
PersonalDetails p = new PersonalDetails();
orcidSecurityManager.checkAndFilter(ORCID_2, p);
fail();
}
Aggregations