use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class PublicV2Test method checkPublicActivities.
public void checkPublicActivities(String readPublicToken) throws JSONException, InterruptedException, URISyntaxException {
createActivities();
ClientResponse activitiesResponse = null;
if (readPublicToken != null) {
activitiesResponse = publicV2ApiClient.viewActivities(getUser1OrcidId(), readPublicToken);
} else {
activitiesResponse = publicV2ApiClient.viewActivities(getUser1OrcidId());
}
assertNotNull(activitiesResponse);
ActivitiesSummary summary = activitiesResponse.getEntity(ActivitiesSummary.class);
assertNotNull(summary);
assertNotNull("There are no educations, please verify users default visibility is public", summary.getEducations());
assertFalse(summary.getEducations().getSummaries().isEmpty());
boolean found0 = false, found3 = false;
for (EducationSummary education : summary.getEducations().getSummaries()) {
if (education.getDepartmentName() != null) {
if (education.getDepartmentName().equals("Education # 0")) {
found0 = true;
} else if (education.getDepartmentName().equals("Education # 3")) {
found3 = true;
}
}
}
assertTrue("One of the educations was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
assertNotNull("There are no employment, please verify users default visibility is public", summary.getEmployments());
assertFalse(summary.getEmployments().getSummaries().isEmpty());
found0 = found3 = false;
for (EmploymentSummary employment : summary.getEmployments().getSummaries()) {
if (employment.getDepartmentName() != null) {
if (employment.getDepartmentName().equals("Employment # 0")) {
found0 = true;
} else if (employment.getDepartmentName().equals("Employment # 3")) {
found3 = true;
}
}
}
assertTrue("One of the employments was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
assertNotNull(summary.getFundings());
found0 = found3 = false;
for (FundingGroup group : summary.getFundings().getFundingGroup()) {
for (FundingSummary funding : group.getFundingSummary()) {
if (funding.getTitle() != null && funding.getTitle().getTitle() != null) {
if (funding.getTitle().getTitle().getContent().equals("Funding # 0")) {
found0 = true;
} else if (funding.getTitle().getTitle().getContent().equals("Funding # 3")) {
found3 = true;
}
}
}
}
assertTrue("One of the fundings was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
assertNotNull(summary.getWorks());
found0 = found3 = false;
for (WorkGroup group : summary.getWorks().getWorkGroup()) {
for (WorkSummary work : group.getWorkSummary()) {
if (work.getTitle().getTitle().getContent().equals("Work # 0")) {
found0 = true;
} else if (work.getTitle().getTitle().getContent().equals("Work # 3")) {
found3 = true;
}
}
}
assertTrue("One of the works was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
assertNotNull(summary.getPeerReviews());
found0 = found3 = false;
for (PeerReviewGroup group : summary.getPeerReviews().getPeerReviewGroup()) {
for (PeerReviewSummary peerReview : group.getPeerReviewSummary()) {
if (peerReview.getCompletionDate() != null && peerReview.getCompletionDate().getYear() != null) {
if (peerReview.getCompletionDate().getYear().getValue().equals("1000")) {
found0 = true;
} else if (peerReview.getCompletionDate().getYear().getValue().equals("4000")) {
found3 = true;
}
}
}
}
assertTrue("One of the peer reviews was not found: 0(" + found0 + ") 3(" + found3 + "), please verify users default visibility is public", found0 == found3 == true);
}
use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testGetPublicEducationsUsingToken.
@Test
public void testGetPublicEducationsUsingToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewEducations(ORCID);
assertNotNull(r);
Educations educations = (Educations) r.getEntity();
assertNotNull(educations);
assertNotNull(educations.getLastModifiedDate());
assertNotNull(educations.getLastModifiedDate().getValue());
assertNotNull(educations.getSummaries());
assertEquals(1, educations.getSummaries().size());
assertEquals(Long.valueOf(20), educations.getSummaries().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, educations.getSummaries().get(0).getVisibility());
assertNotNull(educations.getSummaries().get(0).getLastModifiedDate());
assertNotNull(educations.getSummaries().get(0).getLastModifiedDate().getValue());
}
use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_EducationsTest method testViewEducations.
@Test
public void testViewEducations() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewEducations(ORCID);
assertNotNull(r);
Educations educations = (Educations) r.getEntity();
assertNotNull(educations);
assertEquals("/0000-0000-0000-0003/educations", educations.getPath());
Utils.verifyLastModified(educations.getLastModifiedDate());
assertNotNull(educations.getSummaries());
assertEquals(4, educations.getSummaries().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false;
for (EducationSummary summary : educations.getSummaries()) {
Utils.verifyLastModified(summary.getLastModifiedDate());
if (Long.valueOf(20).equals(summary.getPutCode())) {
assertEquals("PUBLIC Department", summary.getDepartmentName());
found1 = true;
} else if (Long.valueOf(21).equals(summary.getPutCode())) {
assertEquals("LIMITED Department", summary.getDepartmentName());
found2 = true;
} else if (Long.valueOf(22).equals(summary.getPutCode())) {
assertEquals("PRIVATE Department", summary.getDepartmentName());
found3 = true;
} else if (Long.valueOf(25).equals(summary.getPutCode())) {
assertEquals("SELF LIMITED Department", summary.getDepartmentName());
found4 = true;
} else {
fail("Invalid education found: " + summary.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
}
use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testGetPublicEducations.
@Test
public void testGetPublicEducations() {
Response r = serviceDelegator.viewEducations(ORCID);
assertNotNull(r);
Educations educations = (Educations) r.getEntity();
assertNotNull(educations);
assertNotNull(educations.getLastModifiedDate());
assertNotNull(educations.getLastModifiedDate().getValue());
assertNotNull(educations.getSummaries());
assertEquals(1, educations.getSummaries().size());
assertEquals(Long.valueOf(20), educations.getSummaries().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, educations.getSummaries().get(0).getVisibility());
assertNotNull(educations.getSummaries().get(0).getLastModifiedDate());
assertNotNull(educations.getSummaries().get(0).getLastModifiedDate().getValue());
}
use of org.orcid.jaxb.model.record.summary_rc1.Educations in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getEducations.
private Educations getEducations(Visibility... vs) {
Educations e = new Educations();
for (Visibility v : vs) {
EducationSummary s = new EducationSummary();
s.setVisibility(v);
e.getSummaries().add(s);
}
return e;
}
Aggregations