use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testViewPublicEducation.
@Test
public void testViewPublicEducation() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewEducation("4444-4444-4444-4446", 7L);
assertNotNull(response);
Education education = (Education) response.getEntity();
assertNotNull(education);
Utils.verifyLastModified(education.getLastModifiedDate());
assertEquals(Long.valueOf(7L), education.getPutCode());
assertEquals("/4444-4444-4444-4446/education/7", education.getPath());
assertEquals("Education Dept # 2", education.getDepartmentName());
assertEquals(Visibility.PUBLIC.value(), education.getVisibility().value());
}
use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testViewPrivateEducation.
@Test
public void testViewPrivateEducation() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewEducation("4444-4444-4444-4446", 6L);
assertNotNull(response);
Education education = (Education) response.getEntity();
assertNotNull(education);
Utils.verifyLastModified(education.getLastModifiedDate());
assertEquals(Long.valueOf(6L), education.getPutCode());
assertEquals("/4444-4444-4444-4446/education/6", education.getPath());
assertEquals("Education Dept # 1", education.getDepartmentName());
assertEquals(Visibility.PRIVATE.value(), education.getVisibility().value());
}
use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testUpdateEducationChangingVisibilityTest.
@Test(expected = VisibilityMismatchException.class)
public void testUpdateEducationChangingVisibilityTest() {
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(education.getVisibility().equals(Visibility.PRIVATE) ? Visibility.LIMITED : Visibility.PRIVATE);
response = serviceDelegator.updateEducation("4444-4444-4444-4443", 3L, education);
fail();
}
use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testViewEducationReadPublic.
@Test
public void testViewEducationReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewEducation(ORCID, 20L);
Education element = (Education) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/education/20", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.record_rc4.Education in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testUpdateEducationYouAreNotTheSourceOf.
@Test(expected = WrongSourceException.class)
public void testUpdateEducationYouAreNotTheSourceOf() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4442", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewEducation("4444-4444-4444-4442", 1L);
assertNotNull(response);
Education education = (Education) response.getEntity();
assertNotNull(education);
education.setDepartmentName("Updated department name");
education.setRoleTitle("The updated role title");
serviceDelegator.updateEducation("4444-4444-4444-4442", 1L, education);
fail();
}
Aggregations