use of org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary in project ORCID-Source by ORCID.
the class PublicV2Test method testGetInfoWithEmptyToken.
@Test
public void testGetInfoWithEmptyToken() throws InterruptedException, JSONException {
ClientResponse activitiesResponse = publicV2ApiClient.viewActivities(getUser1OrcidId(), "");
assertNotNull(activitiesResponse);
assertEquals(Response.Status.OK.getStatusCode(), activitiesResponse.getStatus());
ActivitiesSummary activities = activitiesResponse.getEntity(ActivitiesSummary.class);
assertNotNull(activities);
}
use of org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testFindActivityDetails.
@Test
public void testFindActivityDetails() {
Response response = serviceDelegator.viewActivities(ORCID);
assertNotNull(response);
ActivitiesSummary summary = (ActivitiesSummary) response.getEntity();
validateActivities(summary);
}
use of org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ActivitiesSummaryTest method testCleanEmptyFieldsOnActivities.
@Test
public void testCleanEmptyFieldsOnActivities() {
LastModifiedDate lmd = new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis()));
Works works = new Works();
works.setLastModifiedDate(lmd);
WorkGroup group = new WorkGroup();
group.setLastModifiedDate(lmd);
for (int i = 0; i < 5; i++) {
WorkSummary summary = new WorkSummary();
summary.setLastModifiedDate(lmd);
WorkTitle title = new WorkTitle();
title.setTitle(new Title("Work " + i));
title.setTranslatedTitle(new TranslatedTitle("", ""));
summary.setTitle(title);
group.getWorkSummary().add(summary);
}
works.getWorkGroup().add(group);
ActivitiesSummary as = new ActivitiesSummary();
as.setWorks(works);
ActivityUtils.cleanEmptyFields(as);
assertNotNull(as);
assertNotNull(as.getWorks());
Utils.verifyLastModified(as.getWorks().getLastModifiedDate());
assertNotNull(as.getWorks().getWorkGroup());
assertEquals(1, as.getWorks().getWorkGroup().size());
assertNotNull(as.getWorks().getWorkGroup().get(0).getWorkSummary());
Utils.verifyLastModified(as.getWorks().getWorkGroup().get(0).getLastModifiedDate());
assertEquals(5, as.getWorks().getWorkGroup().get(0).getWorkSummary().size());
for (WorkSummary summary : as.getWorks().getWorkGroup().get(0).getWorkSummary()) {
Utils.verifyLastModified(summary.getLastModifiedDate());
assertNotNull(summary.getTitle());
assertNotNull(summary.getTitle().getTitle());
assertTrue(summary.getTitle().getTitle().getContent().startsWith("Work "));
assertNull(summary.getTitle().getTranslatedTitle());
}
}
use of org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ActivitiesSummaryTest method testViewActitivies_WorksReadLimited_NoSource.
@Test
public void testViewActitivies_WorksReadLimited_NoSource() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, "APP-5555555555555556", ScopePathType.ORCID_WORKS_READ_LIMITED);
Response response = serviceDelegator.viewActivities(ORCID);
ActivitiesSummary as = (ActivitiesSummary) response.getEntity();
assertNotNull(as);
assertNotNull(as.getPath());
Utils.verifyLastModified(as.getLastModifiedDate());
// Only public educations
assertNotNull(as.getEducations());
assertEquals(1, as.getEducations().getSummaries().size());
assertEquals(Long.valueOf(20), as.getEducations().getSummaries().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, as.getEducations().getSummaries().get(0).getVisibility());
// Only public employments
assertNotNull(as.getEmployments());
assertEquals(1, as.getEmployments().getSummaries().size());
assertEquals(Long.valueOf(17), as.getEmployments().getSummaries().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, as.getEmployments().getSummaries().get(0).getVisibility());
// Only public funding
assertNotNull(as.getFundings());
assertEquals(1, as.getFundings().getFundingGroup().size());
assertEquals(1, as.getFundings().getFundingGroup().get(0).getFundingSummary().size());
assertEquals(Long.valueOf(10), as.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, as.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getVisibility());
// Only public peer reviews
assertNotNull(as.getPeerReviews());
assertEquals(1, as.getPeerReviews().getPeerReviewGroup().size());
assertEquals(1, as.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().size());
assertEquals(Long.valueOf(9), as.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, as.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getVisibility());
// Limited works
assertNotNull(as.getWorks());
assertEquals(3, as.getWorks().getWorkGroup().size());
boolean found1 = false, found2 = false, found3 = false;
for (WorkGroup group : as.getWorks().getWorkGroup()) {
assertEquals(1, group.getWorkSummary().size());
WorkSummary element = group.getWorkSummary().get(0);
if (element.getPutCode().equals(Long.valueOf(11))) {
assertEquals(Visibility.PUBLIC, element.getVisibility());
found1 = true;
} else if (element.getPutCode().equals(Long.valueOf(12))) {
assertEquals(Visibility.LIMITED, element.getVisibility());
found2 = true;
} else if (element.getPutCode().equals(Long.valueOf(14))) {
assertEquals(Visibility.LIMITED, element.getVisibility());
found3 = true;
} else {
fail("Invalid put code " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
}
use of org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ActivitiesSummaryTest method testReadPublicScope_Activities.
@Test
public void testReadPublicScope_Activities() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
// Check you get only public activities
Response r = serviceDelegator.viewActivities(ORCID);
ActivitiesSummary as = (ActivitiesSummary) r.getEntity();
testActivities(as, ORCID);
}
Aggregations