Search in sources :

Example 36 with Education

use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testViewEducation.

@Test
public void testViewEducation() {
    Response response = serviceDelegator.viewEducation(ORCID, 20L);
    assertNotNull(response);
    Education education = (Education) response.getEntity();
    assertNotNull(education);
    assertNotNull(education.getLastModifiedDate());
    assertNotNull(education.getLastModifiedDate().getValue());
    assertEquals(Long.valueOf(20), education.getPutCode());
    assertEquals("/0000-0000-0000-0003/education/20", education.getPath());
    assertEquals("PUBLIC Department", education.getDepartmentName());
    assertEquals(Visibility.PUBLIC.value(), education.getVisibility().value());
    assertEquals("APP-5555555555555555", education.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) Education(org.orcid.jaxb.model.record_v2.Education) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 37 with Education

use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testGetPublicEducationUsingToken.

// Education
@Test
public void testGetPublicEducationUsingToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
    Response r = serviceDelegator.viewEducation(ORCID, 20L);
    assertNotNull(r);
    Education e = (Education) r.getEntity();
    assertNotNull(e);
    assertNotNull(e.getLastModifiedDate());
    assertNotNull(e.getLastModifiedDate().getValue());
    assertEquals(Long.valueOf(20), e.getPutCode());
}
Also used : Response(javax.ws.rs.core.Response) Education(org.orcid.jaxb.model.record_v2.Education) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 38 with Education

use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_EducationsTest method testUpdateEducationLeavingVisibilityNullTest.

@Test
public void testUpdateEducationLeavingVisibilityNullTest() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewEducation("4444-4444-4444-4443", 3L);
    assertNotNull(response);
    Education education = (Education) response.getEntity();
    assertNotNull(education);
    assertEquals(Visibility.PUBLIC, education.getVisibility());
    education.setVisibility(null);
    response = serviceDelegator.updateEducation("4444-4444-4444-4443", 3L, education);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    education = (Education) response.getEntity();
    assertNotNull(education);
    assertEquals(Visibility.PUBLIC, education.getVisibility());
}
Also used : Response(javax.ws.rs.core.Response) Education(org.orcid.jaxb.model.record_v2.Education) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 39 with Education

use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_EducationsTest method testDeleteEducation.

@Test(expected = NoResultException.class)
public void testDeleteEducation() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4447", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewEducation("4444-4444-4444-4447", 12L);
    assertNotNull(response);
    Education education = (Education) response.getEntity();
    assertNotNull(education);
    response = serviceDelegator.deleteAffiliation("4444-4444-4444-4447", 12L);
    assertNotNull(response);
    assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
    serviceDelegator.viewEducation("4444-4444-4444-4447", 12L);
}
Also used : Response(javax.ws.rs.core.Response) Education(org.orcid.jaxb.model.record_v2.Education) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 40 with Education

use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_EducationsTest method testViewLimitedEducation.

@Test
public void testViewLimitedEducation() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
    Response response = serviceDelegator.viewEducation("4444-4444-4444-4446", 9L);
    assertNotNull(response);
    Education education = (Education) response.getEntity();
    assertNotNull(education);
    Utils.verifyLastModified(education.getLastModifiedDate());
    assertEquals(Long.valueOf(9L), education.getPutCode());
    assertEquals("/4444-4444-4444-4446/education/9", education.getPath());
    assertEquals("Education Dept # 3", education.getDepartmentName());
    assertEquals(Visibility.LIMITED.value(), education.getVisibility().value());
}
Also used : Response(javax.ws.rs.core.Response) Education(org.orcid.jaxb.model.record_v2.Education) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)42 Education (org.orcid.jaxb.model.record_v2.Education)42 ClientResponse (com.sun.jersey.api.client.ClientResponse)22 Response (javax.ws.rs.core.Response)13 DBUnitTest (org.orcid.test.DBUnitTest)13 Funding (org.orcid.jaxb.model.record_v2.Funding)8 Work (org.orcid.jaxb.model.record_v2.Work)8 Education (org.orcid.jaxb.model.record_rc1.Education)7 IOException (java.io.IOException)6 InputStreamReader (java.io.InputStreamReader)6 Reader (java.io.Reader)6 ArrayList (java.util.ArrayList)6 OtherName (org.orcid.jaxb.model.record_v2.OtherName)5 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)5 OrcidError (org.orcid.jaxb.model.error_rc1.OrcidError)4 Education (org.orcid.jaxb.model.record_rc2.Education)4 Education (org.orcid.jaxb.model.record_rc3.Education)4 Education (org.orcid.jaxb.model.record_rc4.Education)4 Employment (org.orcid.jaxb.model.record_v2.Employment)4 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)4