use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testViewDistinctions.
@Test
public void testViewDistinctions() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewDistinctions(ORCID);
assertNotNull(r);
Distinctions distinctions = (Distinctions) r.getEntity();
assertNotNull(distinctions);
assertEquals("/0000-0000-0000-0003/distinctions", distinctions.getPath());
Utils.verifyLastModified(distinctions.getLastModifiedDate());
assertNotNull(distinctions.getSummaries());
assertEquals(4, distinctions.getSummaries().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false;
for (DistinctionSummary summary : distinctions.getSummaries()) {
Utils.verifyLastModified(summary.getLastModifiedDate());
if (Long.valueOf(27).equals(summary.getPutCode())) {
assertEquals("PUBLIC Department", summary.getDepartmentName());
found1 = true;
} else if (Long.valueOf(28).equals(summary.getPutCode())) {
assertEquals("LIMITED Department", summary.getDepartmentName());
found2 = true;
} else if (Long.valueOf(29).equals(summary.getPutCode())) {
assertEquals("PRIVATE Department", summary.getDepartmentName());
found3 = true;
} else if (Long.valueOf(30).equals(summary.getPutCode())) {
assertEquals("SELF LIMITED Department", summary.getDepartmentName());
found4 = true;
} else {
fail("Invalid distinction found: " + summary.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testAddDistinctionNoStartDate.
@Test(expected = OrcidValidationException.class)
public void testAddDistinctionNoStartDate() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Distinction distinction = (Distinction) Utils.getAffiliation(AffiliationType.DISTINCTION);
distinction.setStartDate(null);
serviceDelegator.createDistinction(ORCID, distinction);
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class Utils method getAffiliation.
public static Affiliation getAffiliation(AffiliationType type) {
Affiliation a = null;
switch(type) {
case DISTINCTION:
a = new Distinction();
break;
case EDUCATION:
a = new Education();
break;
case EMPLOYMENT:
a = new Employment();
break;
case INVITED_POSITION:
a = new InvitedPosition();
break;
case MEMBERSHIP:
a = new Membership();
break;
case QUALIFICATION:
a = new Qualification();
break;
case SERVICE:
a = new Service();
break;
}
a.setDepartmentName("My department name");
a.setRoleTitle("My Role");
a.setOrganization(getOrganization());
a.setStartDate(FuzzyDate.valueOf(2017, 1, 1));
return a;
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewDistinction.
// Distinction
@Test
public void testViewDistinction() {
Response response = serviceDelegator.viewDistinction(ORCID, 27L);
assertNotNull(response);
Distinction distinction = (Distinction) response.getEntity();
assertNotNull(distinction);
assertNotNull(distinction.getLastModifiedDate());
assertNotNull(distinction.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(27), distinction.getPutCode());
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());
}
use of org.orcid.jaxb.model.v3.dev1.record.Distinction in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testGetPublicDistinctionUsingToken.
@Test
public void testGetPublicDistinctionUsingToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewDistinction(ORCID, 27L);
assertNotNull(r);
Distinction e = (Distinction) r.getEntity();
assertNotNull(e);
assertEquals(Long.valueOf(27), e.getPutCode());
assertNotNull(e.getLastModifiedDate());
assertNotNull(e.getLastModifiedDate().getValue());
}
Aggregations