use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPublicClient_checkAndFilter_Record.
@Test(expected = OrcidUnauthorizedException.class)
public void testPublicClient_checkAndFilter_Record() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, PUBLIC_CLIENT, ScopePathType.READ_PUBLIC);
orcidSecurityManager.checkAndFilter(ORCID_1, new Record());
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class EmailManagerTest method moveEmailToOtherAccountTest.
@Test
public void moveEmailToOtherAccountTest() {
String email = "public@email.com";
String from = "4444-4444-4444-4441";
String to = "4444-4444-4444-4499";
ProfileEntity destinationBefore = profileDao.find(to);
Date beforeLastModified = destinationBefore.getLastModified();
Map<String, String> map = emailManager.findOricdIdsByCommaSeparatedEmails(email);
assertNotNull(map);
assertEquals(from, map.get(email));
emailManager.moveEmailToOtherAccount(email, from, to);
ProfileEntity destinationAfter = profileDao.find(to);
Date afterLastModified = destinationAfter.getLastModified();
assertFalse(beforeLastModified.equals(afterLastModified));
assertTrue(afterLastModified.getTime() > beforeLastModified.getTime());
// Assert the email was moved
map = emailManager.findOricdIdsByCommaSeparatedEmails(email);
assertNotNull(map);
assertEquals(to, map.get(email));
// Assert the email is not anymore in the from record
Emails emails = emailManager.getEmails(from);
for (Email e : emails.getEmails()) {
assertFalse(email.equals(e.getEmail()));
}
// Assert the email belongs to the to record
emails = emailManager.getEmails(to);
boolean found = false;
for (Email e : emails.getEmails()) {
if (email.equals(e.getEmail())) {
found = true;
}
}
assertTrue(found);
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class RecordManagerTest method testGetPublicRecord.
@Test
public void testGetPublicRecord() {
Record record = recordManager.getPublicRecord(ORCID);
assertNotNull(record);
assertNotNull(record.getActivitiesSummary());
assertNotNull(record.getPerson());
Person person = record.getPerson();
assertNotNull(person);
assertNotNull(person.getExternalIdentifiers());
assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers());
assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size());
assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode());
assertNotNull(person.getResearcherUrls());
assertNotNull(person.getResearcherUrls().getResearcherUrls());
assertEquals(1, person.getResearcherUrls().getResearcherUrls().size());
assertEquals(Long.valueOf(13), person.getResearcherUrls().getResearcherUrls().get(0).getPutCode());
assertNotNull(person.getOtherNames());
assertNotNull(person.getOtherNames().getOtherNames());
assertEquals(1, person.getOtherNames().getOtherNames().size());
assertEquals(Long.valueOf(13), person.getOtherNames().getOtherNames().get(0).getPutCode());
assertNotNull(person.getAddresses());
assertNotNull(person.getAddresses().getAddress());
assertEquals(1, person.getAddresses().getAddress().size());
assertEquals(Long.valueOf(9), person.getAddresses().getAddress().get(0).getPutCode());
assertNotNull(person.getKeywords());
assertNotNull(person.getKeywords().getKeywords());
assertEquals(1, person.getKeywords().getKeywords().size());
assertEquals(Long.valueOf(9), person.getKeywords().getKeywords().get(0).getPutCode());
assertNotNull(person.getEmails());
assertNotNull(person.getEmails().getEmails());
assertEquals(1, person.getEmails().getEmails().size());
assertEquals("public_0000-0000-0000-0003@test.orcid.org", person.getEmails().getEmails().get(0).getEmail());
assertNotNull(person.getBiography());
assertEquals(Visibility.PUBLIC, person.getBiography().getVisibility());
assertEquals("Biography for 0000-0000-0000-0003", person.getBiography().getContent());
assertNotNull(person.getName());
assertNotNull(person.getName().getCreditName());
assertEquals("Credit Name", person.getName().getCreditName().getContent());
assertNotNull(person.getName().getFamilyName());
assertEquals("Family Name", person.getName().getFamilyName().getContent());
assertNotNull(person.getName().getGivenNames());
assertEquals("Given Names", person.getName().getGivenNames().getContent());
assertEquals(Visibility.PUBLIC, person.getName().getVisibility());
ActivitiesSummary activities = record.getActivitiesSummary();
assertNotNull(activities.getEducations());
assertNotNull(activities.getEducations().getSummaries());
assertEquals(1, activities.getEducations().getSummaries().size());
assertEquals(Long.valueOf(20), activities.getEducations().getSummaries().get(0).getPutCode());
assertNotNull(activities.getEmployments());
assertNotNull(activities.getEmployments().getSummaries());
assertEquals(1, activities.getEmployments().getSummaries().size());
assertEquals(Long.valueOf(17), activities.getEmployments().getSummaries().get(0).getPutCode());
assertNotNull(activities.getFundings());
assertNotNull(activities.getFundings().getFundingGroup());
assertEquals(1, activities.getFundings().getFundingGroup().size());
assertEquals(Long.valueOf(10), activities.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
assertNotNull(activities.getPeerReviews());
assertNotNull(activities.getPeerReviews().getPeerReviewGroup());
assertEquals(1, activities.getPeerReviews().getPeerReviewGroup().size());
assertEquals(Long.valueOf(9), activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getPutCode());
assertNotNull(activities.getWorks());
assertNotNull(activities.getWorks().getWorkGroup());
assertEquals(1, activities.getWorks().getWorkGroup().size());
assertEquals(Long.valueOf(11), activities.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getPutCode());
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateGroupId_validTest.
/**
* VALIDATE GROUP ID RECORD
*/
@Test
public void validateGroupId_validTest() {
SourceEntity source = mock(SourceEntity.class);
when(source.getSourceName()).thenReturn("source name");
GroupIdRecord g = getGroupIdRecord();
activityValidator.validateGroupIdRecord(g, true, source);
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method viewGroupIdRecord.
@Override
public Response viewGroupIdRecord(Long putCode) {
orcidSecurityManager.checkScopes(ScopePathType.GROUP_ID_RECORD_READ);
GroupIdRecord record = groupIdRecordManagerReadOnly.getGroupIdRecord(putCode);
return Response.ok(record).build();
}
Aggregations