Search in sources :

Example 1 with Educations

use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.

the class PublicV2Test method checkPublicActivities.

public void checkPublicActivities(String readPublicToken) throws JSONException, InterruptedException, URISyntaxException {
    createActivities();
    ClientResponse activitiesResponse = null;
    if (readPublicToken != null) {
        activitiesResponse = publicV2ApiClient.viewActivities(getUser1OrcidId(), readPublicToken);
    } else {
        activitiesResponse = publicV2ApiClient.viewActivities(getUser1OrcidId());
    }
    assertNotNull(activitiesResponse);
    ActivitiesSummary summary = activitiesResponse.getEntity(ActivitiesSummary.class);
    assertNotNull(summary);
    assertNotNull("There are no educations, please verify users default visibility is public", summary.getEducations());
    assertFalse(summary.getEducations().getSummaries().isEmpty());
    boolean found0 = false, found3 = false;
    for (EducationSummary education : summary.getEducations().getSummaries()) {
        if (education.getDepartmentName() != null) {
            if (education.getDepartmentName().equals("Education # 0")) {
                found0 = true;
            } else if (education.getDepartmentName().equals("Education # 3")) {
                found3 = true;
            }
        }
    }
    assertTrue("One of the educations was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
    assertNotNull("There are no employment, please verify users default visibility is public", summary.getEmployments());
    assertFalse(summary.getEmployments().getSummaries().isEmpty());
    found0 = found3 = false;
    for (EmploymentSummary employment : summary.getEmployments().getSummaries()) {
        if (employment.getDepartmentName() != null) {
            if (employment.getDepartmentName().equals("Employment # 0")) {
                found0 = true;
            } else if (employment.getDepartmentName().equals("Employment # 3")) {
                found3 = true;
            }
        }
    }
    assertTrue("One of the employments was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
    assertNotNull(summary.getFundings());
    found0 = found3 = false;
    for (FundingGroup group : summary.getFundings().getFundingGroup()) {
        for (FundingSummary funding : group.getFundingSummary()) {
            if (funding.getTitle() != null && funding.getTitle().getTitle() != null) {
                if (funding.getTitle().getTitle().getContent().equals("Funding # 0")) {
                    found0 = true;
                } else if (funding.getTitle().getTitle().getContent().equals("Funding # 3")) {
                    found3 = true;
                }
            }
        }
    }
    assertTrue("One of the fundings was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
    assertNotNull(summary.getWorks());
    found0 = found3 = false;
    for (WorkGroup group : summary.getWorks().getWorkGroup()) {
        for (WorkSummary work : group.getWorkSummary()) {
            if (work.getTitle().getTitle().getContent().equals("Work # 0")) {
                found0 = true;
            } else if (work.getTitle().getTitle().getContent().equals("Work # 3")) {
                found3 = true;
            }
        }
    }
    assertTrue("One of the works was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
    assertNotNull(summary.getPeerReviews());
    found0 = found3 = false;
    for (PeerReviewGroup group : summary.getPeerReviews().getPeerReviewGroup()) {
        for (PeerReviewSummary peerReview : group.getPeerReviewSummary()) {
            if (peerReview.getCompletionDate() != null && peerReview.getCompletionDate().getYear() != null) {
                if (peerReview.getCompletionDate().getYear().getValue().equals("1000")) {
                    found0 = true;
                } else if (peerReview.getCompletionDate().getYear().getValue().equals("4000")) {
                    found3 = true;
                }
            }
        }
    }
    assertTrue("One of the peer reviews was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) WorkGroup(org.orcid.jaxb.model.record.summary_rc1.WorkGroup) PeerReviewGroup(org.orcid.jaxb.model.record.summary_rc1.PeerReviewGroup) WorkSummary(org.orcid.jaxb.model.record.summary_rc1.WorkSummary) EducationSummary(org.orcid.jaxb.model.record.summary_rc1.EducationSummary) PeerReviewSummary(org.orcid.jaxb.model.record.summary_rc1.PeerReviewSummary) FundingSummary(org.orcid.jaxb.model.record.summary_rc1.FundingSummary) EmploymentSummary(org.orcid.jaxb.model.record.summary_rc1.EmploymentSummary) FundingGroup(org.orcid.jaxb.model.record.summary_rc1.FundingGroup) ActivitiesSummary(org.orcid.jaxb.model.record.summary_rc1.ActivitiesSummary)

Example 2 with Educations

use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testGetPublicEducationsUsingToken.

@Test
public void testGetPublicEducationsUsingToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
    Response r = serviceDelegator.viewEducations(ORCID);
    assertNotNull(r);
    Educations educations = (Educations) r.getEntity();
    assertNotNull(educations);
    assertNotNull(educations.getLastModifiedDate());
    assertNotNull(educations.getLastModifiedDate().getValue());
    assertNotNull(educations.getSummaries());
    assertEquals(1, educations.getSummaries().size());
    assertEquals(Long.valueOf(20), educations.getSummaries().get(0).getPutCode());
    assertEquals(Visibility.PUBLIC, educations.getSummaries().get(0).getVisibility());
    assertNotNull(educations.getSummaries().get(0).getLastModifiedDate());
    assertNotNull(educations.getSummaries().get(0).getLastModifiedDate().getValue());
}
Also used : Response(javax.ws.rs.core.Response) Educations(org.orcid.jaxb.model.record.summary_v2.Educations) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 3 with Educations

use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_EducationsTest method testViewEducations.

@Test
public void testViewEducations() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
    Response r = serviceDelegator.viewEducations(ORCID);
    assertNotNull(r);
    Educations educations = (Educations) r.getEntity();
    assertNotNull(educations);
    assertEquals("/0000-0000-0000-0003/educations", educations.getPath());
    Utils.verifyLastModified(educations.getLastModifiedDate());
    assertNotNull(educations.getSummaries());
    assertEquals(4, educations.getSummaries().size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false;
    for (EducationSummary summary : educations.getSummaries()) {
        Utils.verifyLastModified(summary.getLastModifiedDate());
        if (Long.valueOf(20).equals(summary.getPutCode())) {
            assertEquals("PUBLIC Department", summary.getDepartmentName());
            found1 = true;
        } else if (Long.valueOf(21).equals(summary.getPutCode())) {
            assertEquals("LIMITED Department", summary.getDepartmentName());
            found2 = true;
        } else if (Long.valueOf(22).equals(summary.getPutCode())) {
            assertEquals("PRIVATE Department", summary.getDepartmentName());
            found3 = true;
        } else if (Long.valueOf(25).equals(summary.getPutCode())) {
            assertEquals("SELF LIMITED Department", summary.getDepartmentName());
            found4 = true;
        } else {
            fail("Invalid education found: " + summary.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
}
Also used : Response(javax.ws.rs.core.Response) EducationSummary(org.orcid.jaxb.model.record.summary_v2.EducationSummary) Educations(org.orcid.jaxb.model.record.summary_v2.Educations) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 4 with Educations

use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testGetPublicEducations.

@Test
public void testGetPublicEducations() {
    Response r = serviceDelegator.viewEducations(ORCID);
    assertNotNull(r);
    Educations educations = (Educations) r.getEntity();
    assertNotNull(educations);
    assertNotNull(educations.getLastModifiedDate());
    assertNotNull(educations.getLastModifiedDate().getValue());
    assertNotNull(educations.getSummaries());
    assertEquals(1, educations.getSummaries().size());
    assertEquals(Long.valueOf(20), educations.getSummaries().get(0).getPutCode());
    assertEquals(Visibility.PUBLIC, educations.getSummaries().get(0).getVisibility());
    assertNotNull(educations.getSummaries().get(0).getLastModifiedDate());
    assertNotNull(educations.getSummaries().get(0).getLastModifiedDate().getValue());
}
Also used : Response(javax.ws.rs.core.Response) Educations(org.orcid.jaxb.model.record.summary_v2.Educations) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 5 with Educations

use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method getEducations.

private Educations getEducations(Visibility... vs) {
    Educations e = new Educations();
    for (Visibility v : vs) {
        EducationSummary s = new EducationSummary();
        s.setVisibility(v);
        e.getSummaries().add(s);
    }
    return e;
}
Also used : EducationSummary(org.orcid.jaxb.model.record.summary_v2.EducationSummary) Educations(org.orcid.jaxb.model.record.summary_v2.Educations) Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Aggregations

Test (org.junit.Test)27 Educations (org.orcid.jaxb.model.record.summary_v2.Educations)20 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)14 ClientResponse (com.sun.jersey.api.client.ClientResponse)11 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)8 Employments (org.orcid.jaxb.model.record.summary_v2.Employments)8 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)8 Fundings (org.orcid.jaxb.model.record.summary_v2.Fundings)8 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)8 Works (org.orcid.jaxb.model.record.summary_v2.Works)8 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)6 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)6 InputStream (java.io.InputStream)5 Response (javax.ws.rs.core.Response)5 JAXBContext (javax.xml.bind.JAXBContext)5 Unmarshaller (javax.xml.bind.Unmarshaller)5 BaseTest (org.orcid.core.BaseTest)5 V2Convertible (org.orcid.core.version.V2Convertible)5 FundingGroup (org.orcid.jaxb.model.record.summary_v2.FundingGroup)5 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)5