use of org.orcid.jaxb.model.record_rc1.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);
}
use of org.orcid.jaxb.model.record_rc1.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());
}
use of org.orcid.jaxb.model.record_rc1.Education in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testUpdateEducation.
@Test
public void testUpdateEducation() {
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("Another Department", education.getDepartmentName());
assertEquals("Student", education.getRoleTitle());
Utils.verifyLastModified(education.getLastModifiedDate());
LastModifiedDate before = education.getLastModifiedDate();
education.setDepartmentName("Updated department name");
education.setRoleTitle("The updated role title");
response = serviceDelegator.updateEducation("4444-4444-4444-4443", 3L, education);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
response = serviceDelegator.viewEducation("4444-4444-4444-4443", 3L);
assertNotNull(response);
education = (Education) response.getEntity();
assertNotNull(education);
Utils.verifyLastModified(education.getLastModifiedDate());
assertTrue(education.getLastModifiedDate().after(before));
assertEquals("Updated department name", education.getDepartmentName());
assertEquals("The updated role title", education.getRoleTitle());
// Rollback changes
education.setDepartmentName("Another Department");
education.setRoleTitle("Student");
response = serviceDelegator.updateEducation("4444-4444-4444-4443", 3L, education);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
}
use of org.orcid.jaxb.model.record_rc1.Education in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method getEducation.
private Education getEducation(String userOrcid) {
Education education = new Education();
education.setOrganization(getOrganization());
education = affiliationsManager.createEducationAffiliation(userOrcid, education, true);
return affiliationsManager.getEducationAffiliation(userOrcid, education.getPutCode());
}
use of org.orcid.jaxb.model.record_rc1.Education in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method getAffiliationWithPutCode.
private Education getAffiliationWithPutCode(String userOrcid) {
Education education = new Education();
education.setOrganization(getOrganization());
education.setPutCode(Long.valueOf(111));
education = affiliationsManager.createEducationAffiliation(userOrcid, education, true);
return affiliationsManager.getEducationAffiliation(userOrcid, education.getPutCode());
}
Aggregations