use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testUpdateDistinctionChangingVisibilityTest.
@Test(expected = VisibilityMismatchException.class)
public void testUpdateDistinctionChangingVisibilityTest() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewDistinction(ORCID, 27L);
assertNotNull(response);
Distinction distinction = (Distinction) response.getEntity();
assertNotNull(distinction);
assertEquals(Visibility.PUBLIC, distinction.getVisibility());
distinction.setVisibility(Visibility.PRIVATE);
response = serviceDelegator.updateDistinction(ORCID, 27L, distinction);
fail();
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testUpdateDistinctionYouAreNotTheSourceOf.
@Test(expected = WrongSourceException.class)
public void testUpdateDistinctionYouAreNotTheSourceOf() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewDistinction(ORCID, 30L);
assertNotNull(response);
Distinction distinction = (Distinction) response.getEntity();
assertNotNull(distinction);
distinction.setDepartmentName("Updated department name");
distinction.setRoleTitle("The updated role title");
serviceDelegator.updateDistinction(ORCID, 30L, distinction);
fail();
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testDeleteDistinction.
@Test
public void testDeleteDistinction() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0002", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewDistinction("0000-0000-0000-0002", 1000L);
assertNotNull(response);
Distinction distinction = (Distinction) response.getEntity();
assertNotNull(distinction);
response = serviceDelegator.deleteAffiliation("0000-0000-0000-0002", 1000L);
assertNotNull(response);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
try {
serviceDelegator.viewDistinction("0000-0000-0000-0002", 1000L);
fail();
} catch (NoResultException nre) {
} catch (Exception e) {
fail();
}
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testViewLimitedDistinction.
@Test
public void testViewLimitedDistinction() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewDistinction(ORCID, 30L);
assertNotNull(response);
Distinction distinction = (Distinction) response.getEntity();
assertNotNull(distinction);
Utils.verifyLastModified(distinction.getLastModifiedDate());
assertEquals(Long.valueOf(30L), distinction.getPutCode());
assertEquals("/0000-0000-0000-0003/distinction/30", distinction.getPath());
assertEquals("SELF LIMITED Department", distinction.getDepartmentName());
assertEquals(Visibility.LIMITED.value(), distinction.getVisibility().value());
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewDistinctions.
@Test
public void testViewDistinctions() {
Response response = serviceDelegator.viewDistinctions(ORCID);
assertNotNull(response);
Distinctions distinctions = (Distinctions) response.getEntity();
assertNotNull(distinctions);
assertEquals("/0000-0000-0000-0003/distinctions", distinctions.getPath());
assertNotNull(distinctions.getLastModifiedDate());
assertNotNull(distinctions.getLastModifiedDate().getValue());
assertEquals(1, distinctions.getSummaries().size());
DistinctionSummary distinction = distinctions.getSummaries().get(0);
assertEquals(Long.valueOf(27), distinction.getPutCode());
assertNotNull(distinction.getLastModifiedDate());
assertNotNull(distinction.getLastModifiedDate().getValue());
assertEquals("/0000-0000-0000-0003/distinction/27", distinction.getPath());
assertEquals("PUBLIC Department", distinction.getDepartmentName());
assertEquals(Visibility.PUBLIC.value(), distinction.getVisibility().value());
assertEquals("APP-5555555555555555", distinction.getSource().retrieveSourcePath());
}
Aggregations