use of org.orcid.jaxb.model.record_rc2.Employment in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EmploymentsTest method testUpdateEmploymentLeavingVisibilityNullTest.
@Test
public void testUpdateEmploymentLeavingVisibilityNullTest() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewEmployment("4444-4444-4444-4446", 5L);
assertNotNull(response);
Employment employment = (Employment) response.getEntity();
assertNotNull(employment);
assertEquals(Visibility.PRIVATE, employment.getVisibility());
employment.setVisibility(null);
response = serviceDelegator.updateEmployment("4444-4444-4444-4446", 5L, employment);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
employment = (Employment) response.getEntity();
assertNotNull(employment);
assertEquals(Visibility.PRIVATE, employment.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.Employment in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EmploymentsTest method testViewLimitedEmployment.
@Test
public void testViewLimitedEmployment() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewEmployment("4444-4444-4444-4446", 11L);
assertNotNull(response);
Employment employment = (Employment) response.getEntity();
assertNotNull(employment);
Utils.verifyLastModified(employment.getLastModifiedDate());
assertEquals(Long.valueOf(11L), employment.getPutCode());
assertEquals("/4444-4444-4444-4446/employment/11", employment.getPath());
assertEquals("Employment Dept # 4", employment.getDepartmentName());
assertEquals(Visibility.LIMITED.value(), employment.getVisibility().value());
}
use of org.orcid.jaxb.model.record_rc2.Employment in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EmploymentsTest method testDeleteEmployment.
@Test(expected = NoResultException.class)
public void testDeleteEmployment() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4444", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewEmployment("4444-4444-4444-4444", 14L);
assertNotNull(response);
Employment employment = (Employment) response.getEntity();
assertNotNull(employment);
response = serviceDelegator.deleteAffiliation("4444-4444-4444-4444", 14L);
assertNotNull(response);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
serviceDelegator.viewEmployment("4444-4444-4444-4444", 14L);
}
use of org.orcid.jaxb.model.record_rc2.Employment in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EmploymentsTest method testUpdateEmploymentChangingVisibilityTest.
@Test(expected = VisibilityMismatchException.class)
public void testUpdateEmploymentChangingVisibilityTest() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewEmployment("4444-4444-4444-4446", 5L);
assertNotNull(response);
Employment employment = (Employment) response.getEntity();
assertNotNull(employment);
assertEquals(Visibility.PRIVATE, employment.getVisibility());
employment.setVisibility(Visibility.LIMITED);
response = serviceDelegator.updateEmployment("4444-4444-4444-4446", 5L, employment);
fail();
}
use of org.orcid.jaxb.model.record_rc2.Employment in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EmploymentsTest method testUpdateEmploymentYouAreNotTheSourceOf.
@Test(expected = WrongSourceException.class)
public void testUpdateEmploymentYouAreNotTheSourceOf() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewEmployment("4444-4444-4444-4446", 11L);
assertNotNull(response);
Employment employment = (Employment) response.getEntity();
assertNotNull(employment);
employment.setDepartmentName("Updated department name");
employment.setRoleTitle("The updated role title");
serviceDelegator.updateEmployment("4444-4444-4444-4446", 11L, employment);
fail();
}
Aggregations