use of org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary in project ORCID-Source by ORCID.
the class OrcidSecurityManager_FullRecordTest method testRecord_When_AllPrivate_NoSource_ReadPublicToken.
@Test
public void testRecord_When_AllPrivate_NoSource_ReadPublicToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Name name = createName(Visibility.PRIVATE);
Biography bio = createBiography(Visibility.PRIVATE);
Address a1 = createAddress(Visibility.PRIVATE, CLIENT_2);
Address a2 = createAddress(Visibility.PRIVATE, CLIENT_2);
Address a3 = createAddress(Visibility.PRIVATE, CLIENT_2);
Addresses addresses = new Addresses();
addresses.setAddress(new ArrayList<Address>(Arrays.asList(a1, a2, a3)));
Email e1 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e2 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
Emails emails = new Emails();
emails.setEmails(new ArrayList<Email>(Arrays.asList(e1, e2, e3)));
Keyword k1 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keyword k2 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keyword k3 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keywords keywords = new Keywords();
keywords.setKeywords(new ArrayList<Keyword>(Arrays.asList(k1, k2, k3)));
OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherNames otherNames = new OtherNames();
otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
PersonExternalIdentifier ext1 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifier ext2 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifier ext3 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifiers extIds = new PersonExternalIdentifiers();
extIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(Arrays.asList(ext1, ext2, ext3)));
ResearcherUrl r1 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrl r2 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrl r3 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(Arrays.asList(r1, r2, r3)));
EducationSummary edu1 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EducationSummary edu2 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EducationSummary edu3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em1 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em2 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
FundingSummary f1 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
FundingSummary f2 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
FundingSummary f3 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
PeerReviewSummary p1 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
PeerReviewSummary p2 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
PeerReviewSummary p3 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
WorkSummary w1 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
WorkSummary w2 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
WorkSummary w3 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
DistinctionSummary d1 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
DistinctionSummary d2 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
DistinctionSummary d3 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
InvitedPositionSummary i1 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
InvitedPositionSummary i2 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
InvitedPositionSummary i3 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
MembershipSummary m1 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
MembershipSummary m2 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
MembershipSummary m3 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
QualificationSummary q1 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
QualificationSummary q2 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
QualificationSummary q3 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
ServiceSummary s1 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
ServiceSummary s2 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
ServiceSummary s3 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
ActivitiesSummary as = new ActivitiesSummary();
as.setEducations(createEducations(edu1, edu2, edu3));
as.setEmployments(createEmployments(em1, em2, em3));
as.setFundings(createFundings(f1, f2, f3));
as.setPeerReviews(createPeerReviews(p1, p2, p3));
as.setWorks(createWorks(w1, w2, w3));
as.setDistinctions(createDistinctions(d1, d2, d3));
as.setInvitedPositions(createInvitedPositions(i1, i2, i3));
as.setMemberships(createMemberships(m1, m2, m3));
as.setQualifications(createQualifications(q1, q2, q3));
as.setServices(createServices(s1, s2, s3));
Person p = new Person();
p.setBiography(bio);
p.setName(name);
p.setAddresses(addresses);
p.setEmails(emails);
p.setExternalIdentifiers(extIds);
p.setKeywords(keywords);
p.setOtherNames(otherNames);
p.setResearcherUrls(researcherUrls);
Record record = new Record();
record.setActivitiesSummary(as);
record.setPerson(p);
orcidSecurityManager.checkAndFilter(ORCID_1, record);
assertNotNull(record);
// Check person
assertNull(p.getName());
assertNull(p.getBiography());
// Check addresses
assertEquals(0, p.getAddresses().getAddress().size());
// Check emails
assertEquals(0, p.getEmails().getEmails().size());
// Check ext ids
assertEquals(0, p.getExternalIdentifiers().getExternalIdentifiers().size());
// Check keywords
assertEquals(0, p.getKeywords().getKeywords().size());
// Check other names
assertEquals(0, p.getOtherNames().getOtherNames().size());
// Check researcher urls
assertEquals(0, p.getResearcherUrls().getResearcherUrls().size());
// Check activities
assertNotNull(as);
// Check distinctions
assertEquals(0, as.getDistinctions().getSummaries().size());
// Check invited positions
assertEquals(0, as.getInvitedPositions().getSummaries().size());
// Check memberships
assertEquals(0, as.getMemberships().getSummaries().size());
// Check qualifications
assertEquals(0, as.getQualifications().getSummaries().size());
// Check services
assertEquals(0, as.getServices().getSummaries().size());
// Check educations
assertEquals(0, as.getEducations().getSummaries().size());
// Check employments
assertEquals(0, as.getEmployments().getSummaries().size());
// Check fundings
assertEquals(0, as.getFundings().getFundingGroup().size());
// Check peer reviews
assertEquals(0, as.getPeerReviews().getPeerReviewGroup().size());
// Check works
assertEquals(0, as.getWorks().getWorkGroup().size());
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method testGroupPeerReviews_groupOnlyPublicPeerReviews2.
@Test
public void testGroupPeerReviews_groupOnlyPublicPeerReviews2() {
PeerReviewSummary s1 = getPeerReviewSummary("public-peer-review-group-id-1", "ext-id-1", Visibility.PUBLIC);
PeerReviewSummary s2 = getPeerReviewSummary("limited-peer-review-group-id-1", "ext-id-2", Visibility.LIMITED);
PeerReviewSummary s3 = getPeerReviewSummary("private-peer-review-group-id-1", "ext-id-3", Visibility.PRIVATE);
PeerReviewSummary s4 = getPeerReviewSummary("public-peer-review-group-id-1", "ext-id-4", Visibility.PUBLIC);
PeerReviewSummary s5 = getPeerReviewSummary("limited-peer-review-group-id-1", "ext-id-5", Visibility.LIMITED);
PeerReviewSummary s6 = getPeerReviewSummary("private-peer-review-group-id-1", "ext-id-6", Visibility.PRIVATE);
PeerReviewSummary s7 = getPeerReviewSummary("public-peer-review-group-id-2", "ext-id-7", Visibility.PUBLIC);
PeerReviewSummary s8 = getPeerReviewSummary("limited-peer-review-group-id-2", "ext-id-8", Visibility.LIMITED);
PeerReviewSummary s9 = getPeerReviewSummary("private-peer-review-group-id-2", "ext-id-9", Visibility.PRIVATE);
List<PeerReviewSummary> peerReviewList = Arrays.asList(s1, s2, s3, s4, s5, s6, s7, s8, s9);
/**
* They should be grouped as
*
* Group 1: ext-id-1 + ext-id-4
* Group 2: ext-id-7
*/
PeerReviews peerReviews = peerReviewManager.groupPeerReviews(peerReviewList, true);
assertNotNull(peerReviews);
assertEquals(2, peerReviews.getPeerReviewGroup().size());
assertEquals(1, peerReviews.getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
assertEquals("public-peer-review-group-id-1", peerReviews.getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals(2, peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().size());
assertThat(peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue(), anyOf(is("ext-id-1"), is("ext-id-4")));
assertThat(peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().get(1).getExternalIdentifiers().getExternalIdentifier().get(0).getValue(), anyOf(is("ext-id-1"), is("ext-id-4")));
assertEquals(1, peerReviews.getPeerReviewGroup().get(1).getIdentifiers().getExternalIdentifier().size());
assertEquals("public-peer-review-group-id-2", peerReviews.getPeerReviewGroup().get(1).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals(1, peerReviews.getPeerReviewGroup().get(1).getPeerReviewSummary().size());
assertEquals("ext-id-7", peerReviews.getPeerReviewGroup().get(1).getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method getPeerReviewSummary.
private PeerReviewSummary getPeerReviewSummary(String titleValue, String extIdValue, Visibility visibility) {
PeerReviewSummary summary = new PeerReviewSummary();
summary.setGroupId(titleValue);
summary.setVisibility(visibility);
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("doi");
extId.setUrl(new Url("http://orcid.org"));
extId.setValue(extIdValue);
extIds.getExternalIdentifier().add(extId);
summary.setExternalIdentifiers(extIds);
return summary;
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method testGroupPeerReviews_groupOnlyPublicPeerReviews1.
@Test
public void testGroupPeerReviews_groupOnlyPublicPeerReviews1() {
PeerReviewSummary s1 = getPeerReviewSummary("public-peer-review-group-id-1", "ext-id-1", Visibility.PUBLIC);
PeerReviewSummary s2 = getPeerReviewSummary("limited-peer-review-group-id-1", "ext-id-2", Visibility.LIMITED);
PeerReviewSummary s3 = getPeerReviewSummary("private-peer-review-group-id-1", "ext-id-3", Visibility.PRIVATE);
PeerReviewSummary s4 = getPeerReviewSummary("public-peer-review-group-id-2", "ext-id-4", Visibility.PUBLIC);
PeerReviewSummary s5 = getPeerReviewSummary("limited-peer-review-group-id-2", "ext-id-5", Visibility.LIMITED);
PeerReviewSummary s6 = getPeerReviewSummary("private-peer-review-group-id-2", "ext-id-6", Visibility.PRIVATE);
PeerReviewSummary s7 = getPeerReviewSummary("public-peer-review-group-id-3", "ext-id-7", Visibility.PUBLIC);
PeerReviewSummary s8 = getPeerReviewSummary("limited-peer-review-group-id-3", "ext-id-8", Visibility.LIMITED);
PeerReviewSummary s9 = getPeerReviewSummary("private-peer-review-group-id-3", "ext-id-9", Visibility.PRIVATE);
List<PeerReviewSummary> workList = Arrays.asList(s1, s2, s3, s4, s5, s6, s7, s8, s9);
/**
* They should be grouped as
*
* Group 1: Public 1
* Group 2: Public 2
* Group 3: Public 3
*/
PeerReviews peerReviews = peerReviewManager.groupPeerReviews(workList, true);
assertNotNull(peerReviews);
assertEquals(3, peerReviews.getPeerReviewGroup().size());
assertEquals(1, peerReviews.getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().size());
assertEquals(1, peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().size());
assertEquals("public-peer-review-group-id-1", peerReviews.getPeerReviewGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("public-peer-review-group-id-1", peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getGroupId());
assertEquals(1, peerReviews.getPeerReviewGroup().get(1).getIdentifiers().getExternalIdentifier().size());
assertEquals(1, peerReviews.getPeerReviewGroup().get(1).getPeerReviewSummary().size());
assertEquals("public-peer-review-group-id-2", peerReviews.getPeerReviewGroup().get(1).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("public-peer-review-group-id-2", peerReviews.getPeerReviewGroup().get(1).getPeerReviewSummary().get(0).getGroupId());
assertEquals(1, peerReviews.getPeerReviewGroup().get(2).getIdentifiers().getExternalIdentifier().size());
assertEquals(1, peerReviews.getPeerReviewGroup().get(2).getPeerReviewSummary().size());
assertEquals("public-peer-review-group-id-3", peerReviews.getPeerReviewGroup().get(2).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("public-peer-review-group-id-3", peerReviews.getPeerReviewGroup().get(2).getPeerReviewSummary().get(0).getGroupId());
}
use of org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method nonGroupableIdsGenerateEmptyIdsListTest.
@Test
public void nonGroupableIdsGenerateEmptyIdsListTest() {
PeerReviewSummary s1 = getPeerReviewSummary("Element 1", "ext-id-1", Visibility.PUBLIC);
PeerReviewSummary s2 = getPeerReviewSummary("Element 2", "ext-id-2", Visibility.LIMITED);
PeerReviewSummary s3 = getPeerReviewSummary("Element 3", "ext-id-3", Visibility.PRIVATE);
// Remove the grouping id from s1
s1.setGroupId(null);
List<PeerReviewSummary> peerReviewsList = Arrays.asList(s1, s2, s3);
/**
* They should be grouped as
*
* Group 1: Element 1
* Group 2: Element 2
* Group 3: Element 3
*/
PeerReviews peerReviews = peerReviewManager.groupPeerReviews(peerReviewsList, false);
assertNotNull(peerReviews);
assertEquals(3, peerReviews.getPeerReviewGroup().size());
boolean foundEmptyGroup = false;
boolean found2 = false;
boolean found3 = false;
for (PeerReviewGroup group : peerReviews.getPeerReviewGroup()) {
assertEquals(1, group.getPeerReviewSummary().size());
assertNotNull(group.getIdentifiers().getExternalIdentifier());
assertEquals(1, group.getIdentifiers().getExternalIdentifier().size());
if (group.getIdentifiers().getExternalIdentifier().get(0).getValue() == null) {
assertEquals("ext-id-1", group.getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
foundEmptyGroup = true;
} else if (group.getIdentifiers().getExternalIdentifier().get(0).getValue().equals("Element 2")) {
assertEquals("ext-id-2", group.getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
found2 = true;
} else if (group.getIdentifiers().getExternalIdentifier().get(0).getValue().equals("Element 3")) {
assertEquals("ext-id-3", group.getPeerReviewSummary().get(0).getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
found3 = true;
} else {
fail("Invalid ext id found " + group.getIdentifiers().getExternalIdentifier().get(0).getValue());
}
}
assertTrue(foundEmptyGroup);
assertTrue(found2);
assertTrue(found3);
}
Aggregations