use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class ContributorUtilsTest method getWorkWithContributorWithoutOrcid.
private Work getWorkWithContributorWithoutOrcid() {
Work work = new Work();
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title("work with contributor without ORCID record"));
work.setWorkTitle(workTitle);
work.setWorkContributors(getWorkContributorWithoutOrcid());
return work;
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ReadRecordTest method testReadPrivateEmails_OtherThingsJustPublic_Record.
@Test
public void testReadPrivateEmails_OtherThingsJustPublic_Record() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, "APP-5555555555555556", ScopePathType.EMAIL_READ_PRIVATE);
Response response = serviceDelegator.viewRecord(ORCID);
assertNotNull(response);
assertEquals(Record.class.getName(), response.getEntity().getClass().getName());
Record r = (Record) response.getEntity();
assertNotNull(r);
assertEquals("/0000-0000-0000-0003", r.getPath());
Utils.assertIsPublicOrSource(r.getActivitiesSummary(), "APP-5555555555555556");
Person p = r.getPerson();
// Check email
// Email
assertNotNull(p.getEmails());
Emails email = p.getEmails();
assertNotNull(email);
Utils.verifyLastModified(email.getLastModifiedDate());
assertEquals(5, email.getEmails().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (Email element : email.getEmails()) {
if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) {
found1 = true;
} else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) {
found2 = true;
} else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) {
found3 = true;
} else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) {
found4 = true;
} else if (element.getEmail().equals("self_private_0000-0000-0000-0003@test.orcid.org")) {
found5 = true;
} else {
fail("Invalid email " + element.getEmail());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
this.assertAllPublicButEmails(p);
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ReadRecordTest method testViewRecordReadPublic.
@Test
public void testViewRecordReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewRecord(ORCID);
Record record = (Record) r.getEntity();
assertNotNull(record);
assertEquals("/0000-0000-0000-0003", record.getPath());
assertEquals("/0000-0000-0000-0003/activities", record.getActivitiesSummary().getPath());
Utils.assertIsPublicOrSource(record.getActivitiesSummary(), "APP-5555555555555555");
assertEquals("/0000-0000-0000-0003/person", record.getPerson().getPath());
Utils.assertIsPublicOrSource(record.getPerson(), "APP-5555555555555555");
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ReadRecordTest method testReadPublicScope_Record.
@Test
public void testReadPublicScope_Record() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
Response response = serviceDelegator.viewRecord(ORCID);
assertNotNull(response);
Record record = (Record) response.getEntity();
assertEquals("/0000-0000-0000-0003", record.getPath());
testPerson(record.getPerson(), ORCID);
testActivities(record.getActivitiesSummary(), ORCID);
assertNotNull(record.getHistory());
assertEquals(OrcidType.USER, record.getOrcidType());
assertNotNull(record.getPreferences());
assertEquals(Locale.EN, record.getPreferences().getLocale());
History history = record.getHistory();
assertTrue(history.getClaimed());
assertNotNull(history.getCompletionDate());
assertEquals(CreationMethod.INTEGRATION_TEST, history.getCreationMethod());
assertNull(history.getDeactivationDate());
Utils.verifyLastModified(history.getLastModifiedDate());
assertNotNull(history.getSource());
assertEquals("APP-5555555555555555", history.getSource().retrieveSourcePath());
assertNotNull(history.getSubmissionDate());
assertNotNull(record.getOrcidIdentifier());
OrcidIdentifier id = record.getOrcidIdentifier();
assertEquals("0000-0000-0000-0003", id.getPath());
}
use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ReadRecordTest method testViewRecordWrongScope.
@Test
public void testViewRecordWrongScope() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
Response response = serviceDelegator.viewRecord(ORCID);
// Verify everything inside is public
Record record = (Record) response.getEntity();
assertNotNull(record);
assertEquals("/0000-0000-0000-0003", record.getPath());
assertEquals("/0000-0000-0000-0003/activities", record.getActivitiesSummary().getPath());
Utils.assertIsPublicOrSource(record.getActivitiesSummary(), SecurityContextTestUtils.DEFAULT_CLIENT_ID);
assertEquals("/0000-0000-0000-0003/person", record.getPerson().getPath());
Utils.assertIsPublicOrSource(record.getPerson(), SecurityContextTestUtils.DEFAULT_CLIENT_ID);
}
Aggregations