use of org.orcid.jaxb.model.record_rc4.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_rc4.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_rc4.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();
}
use of org.orcid.jaxb.model.record_rc4.Employment in project ORCID-Source by ORCID.
the class JpaJaxbEmploymentAdapterTest method testToOrgAffiliationRelationEntity.
@Test
public void testToOrgAffiliationRelationEntity() throws JAXBException {
Employment e = getEmployment(true);
assertNotNull(e);
OrgAffiliationRelationEntity oar = jpaJaxbEmploymentAdapter.toOrgAffiliationRelationEntity(e);
assertNotNull(oar);
//General info
assertEquals(Long.valueOf(0), oar.getId());
assertEquals(Visibility.PRIVATE.value(), oar.getVisibility().value());
assertEquals("employment:department-name", oar.getDepartment());
assertEquals("employment:role-title", oar.getTitle());
//Dates
assertEquals(Integer.valueOf(2), oar.getStartDate().getDay());
assertEquals(Integer.valueOf(2), oar.getStartDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getStartDate().getYear());
assertEquals(Integer.valueOf(2), oar.getEndDate().getDay());
assertEquals(Integer.valueOf(2), oar.getEndDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getEndDate().getYear());
//Source
assertNull(oar.getSourceId());
assertNull(oar.getClientSourceId());
assertNull(oar.getElementSourceId());
}
use of org.orcid.jaxb.model.record_rc4.Employment in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateEmployment_validEmploymentTest.
/**
* VALIDATE AFFILIATIONS
* */
@Test
public void validateEmployment_validEmploymentTest() {
Employment employment = getEmployment();
activityValidator.validateEmployment(employment, null, true, true, Visibility.PUBLIC);
}
Aggregations