Search in sources :

Example 36 with PersonalDetails

use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.

the class ValidateV2RC4SamplesTest method testUnmarshallPersonalDetails.

@Test
public void testUnmarshallPersonalDetails() throws SAXException, URISyntaxException {
    PersonalDetails personalDetails = (PersonalDetails) unmarshallFromPath("/record_2.0_rc4/samples/personal-details-2.0_rc4.xml", PersonalDetails.class, "/record_2.0_rc4/personal-details-2.0_rc4.xsd");
    assertNotNull(personalDetails);
    // Check bio
    assertNotNull(personalDetails.getBiography());
    assertEquals("Biography", personalDetails.getBiography().getContent());
    assertEquals(Visibility.PUBLIC.value(), personalDetails.getBiography().getVisibility().value());
    // Check names
    assertNotNull(personalDetails.getName());
    assertNotNull(personalDetails.getName().getCreditName());
    assertEquals("Credit Name", personalDetails.getName().getCreditName().getContent());
    assertNotNull(personalDetails.getName().getGivenNames());
    assertEquals("Give Names", personalDetails.getName().getGivenNames().getContent());
    assertNotNull(personalDetails.getName().getFamilyName());
    assertEquals("Family Name", personalDetails.getName().getFamilyName().getContent());
    assertEquals(Visibility.PUBLIC.value(), personalDetails.getName().getVisibility().value());
    // Check other names
    assertNotNull(personalDetails.getOtherNames());
    assertNotNull(personalDetails.getOtherNames().getOtherNames());
    assertEquals(2, personalDetails.getOtherNames().getOtherNames().size());
    assertEquals("Other Name #1", personalDetails.getOtherNames().getOtherNames().get(0).getContent());
    assertEquals("Other Name #2", personalDetails.getOtherNames().getOtherNames().get(1).getContent());
    assertEquals(Visibility.PUBLIC, personalDetails.getOtherNames().getOtherNames().get(0).getVisibility());
    assertEquals(Visibility.LIMITED, personalDetails.getOtherNames().getOtherNames().get(1).getVisibility());
}
Also used : PersonalDetails(org.orcid.jaxb.model.record_rc4.PersonalDetails) Test(org.junit.Test)

Example 37 with PersonalDetails

use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.

the class ValidateV2SamplesTest method testUnmarshallPersonalDetails.

@Test
public void testUnmarshallPersonalDetails() throws SAXException, URISyntaxException {
    PersonalDetails personalDetails = (PersonalDetails) unmarshallFromPath("/record_2.0/samples/read_samples/personal-details-2.0.xml", PersonalDetails.class, "/record_2.0/personal-details-2.0.xsd");
    assertNotNull(personalDetails);
    // Check bio
    assertNotNull(personalDetails.getBiography());
    assertEquals("Biography", personalDetails.getBiography().getContent());
    assertEquals(Visibility.PUBLIC.value(), personalDetails.getBiography().getVisibility().value());
    // Check names
    assertNotNull(personalDetails.getName());
    assertNotNull(personalDetails.getName().getCreditName());
    assertEquals("Credit Name", personalDetails.getName().getCreditName().getContent());
    assertNotNull(personalDetails.getName().getGivenNames());
    assertEquals("Give Names", personalDetails.getName().getGivenNames().getContent());
    assertNotNull(personalDetails.getName().getFamilyName());
    assertEquals("Family Name", personalDetails.getName().getFamilyName().getContent());
    assertEquals(Visibility.PUBLIC.value(), personalDetails.getName().getVisibility().value());
    // Check other names
    assertNotNull(personalDetails.getOtherNames());
    assertNotNull(personalDetails.getOtherNames().getOtherNames());
    assertEquals(2, personalDetails.getOtherNames().getOtherNames().size());
    assertEquals("Other Name #1", personalDetails.getOtherNames().getOtherNames().get(0).getContent());
    assertEquals("Other Name #2", personalDetails.getOtherNames().getOtherNames().get(1).getContent());
    assertEquals(Visibility.PUBLIC, personalDetails.getOtherNames().getOtherNames().get(0).getVisibility());
    assertEquals(Visibility.LIMITED, personalDetails.getOtherNames().getOtherNames().get(1).getVisibility());
}
Also used : PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) Test(org.junit.Test)

Example 38 with PersonalDetails

use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method getPersonalDetailsElement.

private PersonalDetails getPersonalDetailsElement(Visibility nameVisibility, Visibility bioVisiblity, Visibility otherNamesVisibility) {
    PersonalDetails p = new PersonalDetails();
    Name name = new Name();
    name.setVisibility(nameVisibility);
    p.setName(name);
    Biography bio = new Biography();
    bio.setVisibility(bioVisiblity);
    bio.setContent("Bio test");
    p.setBiography(bio);
    p.setOtherNames(getOtherNamesElement(otherNamesVisibility));
    return p;
}
Also used : Biography(org.orcid.jaxb.model.record_v2.Biography) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name)

Example 39 with PersonalDetails

use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorImpl method viewPersonalDetails.

@Override
public Response viewPersonalDetails(String orcid) {
    PersonalDetails personalDetails = personalDetailsManagerReadOnly.getPublicPersonalDetails(orcid);
    publicAPISecurityManagerV2.filter(personalDetails);
    ElementUtils.setPathToPersonalDetails(personalDetails, orcid);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(personalDetails);
    sourceUtilsReadOnly.setSourceName(personalDetails);
    return Response.ok(personalDetails).build();
}
Also used : PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails)

Example 40 with PersonalDetails

use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_PersonalDetailsTest method testViewPersonalDetailsReadPublic.

@Test
public void testViewPersonalDetailsReadPublic() {
    SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
    Response r = serviceDelegator.viewPersonalDetails(ORCID);
    PersonalDetails element = (PersonalDetails) r.getEntity();
    assertNotNull(element);
    assertEquals("/0000-0000-0000-0003/personal-details", element.getPath());
    Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
Also used : Response(javax.ws.rs.core.Response) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)34 PersonalDetails (org.orcid.jaxb.model.record_v2.PersonalDetails)34 OtherName (org.orcid.jaxb.model.record_v2.OtherName)21 Biography (org.orcid.jaxb.model.record_v2.Biography)16 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)16 Name (org.orcid.jaxb.model.record_v2.Name)14 IOException (java.io.IOException)6 BaseTest (org.orcid.core.BaseTest)6 InputStreamReader (java.io.InputStreamReader)5 Reader (java.io.Reader)5 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)5 Response (javax.ws.rs.core.Response)4 Funding (org.orcid.jaxb.model.record_v2.Funding)4 DBUnitTest (org.orcid.test.DBUnitTest)4 ArrayList (java.util.ArrayList)3 Address (org.orcid.jaxb.model.record_v2.Address)3 Education (org.orcid.jaxb.model.record_v2.Education)3 Work (org.orcid.jaxb.model.record_v2.Work)3 Date (java.util.Date)2 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)2