use of org.neo4j.driver.v1.Record in project ORCID-Source by ORCID.
the class OrcidSecurityManager_FullRecordTest method testRecord_When_ReadLimitedToken_EmptyElement.
@Test
public void testRecord_When_ReadLimitedToken_EmptyElement() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_LIMITED);
Record record = new Record();
orcidSecurityManager.checkAndFilter(ORCID_1, record);
assertNotNull(record);
}
use of org.neo4j.driver.v1.Record in project ORCID-Source by ORCID.
the class OrcidRecordToSolrDocumentTest method getRecord.
private Record getRecord(String name) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(Record.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
InputStream inputStream = this.getClass().getResourceAsStream(name);
return (Record) unmarshaller.unmarshal(inputStream);
}
use of org.neo4j.driver.v1.Record in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewRecord.
@Override
public Response viewRecord(String orcid) {
Record record = recordManagerReadOnly.getPublicRecord(orcid);
publicAPISecurityManagerV2.filter(record);
if (record.getPerson() != null) {
sourceUtilsReadOnly.setSourceName(record.getPerson());
}
if (record.getActivitiesSummary() != null) {
ActivityUtils.cleanEmptyFields(record.getActivitiesSummary());
sourceUtilsReadOnly.setSourceName(record.getActivitiesSummary());
}
ElementUtils.setPathToRecord(record, orcid);
Api2_0_LastModifiedDatesHelper.calculateLastModified(record);
return Response.ok(record).build();
}
use of org.neo4j.driver.v1.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.neo4j.driver.v1.Record in project ORCID-Source by ORCID.
the class ValidateV2RC3Identifiers method testRecord.
@Test
public void testRecord() {
Record record = unmarshallFromPath("/record_2.0_rc3/samples/record-2.0_rc3.xml", Record.class);
ActivitiesSummary as = record.getActivitiesSummary();
ExternalIDs fundingIDs = as.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getExternalIdentifiers();
ExternalIDs fundingIDs2 = as.getFundings().getFundingGroup().get(0).getIdentifiers();
assertEquals("grant_number", fundingIDs.getExternalIdentifier().get(0).getType());
assertEquals("external-id-value", fundingIDs.getExternalIdentifier().get(0).getValue());
assertEquals(new Url("http://tempuri.org"), fundingIDs.getExternalIdentifier().get(0).getUrl());
assertEquals(Relationship.SELF, fundingIDs.getExternalIdentifier().get(0).getRelationship());
assertEquals(fundingIDs.getExternalIdentifier().get(0).getType(), fundingIDs2.getExternalIdentifier().get(0).getType());
assertEquals(fundingIDs.getExternalIdentifier().get(0).getValue(), fundingIDs2.getExternalIdentifier().get(0).getValue());
ExternalIDs workIDs = as.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getExternalIdentifiers();
ExternalIDs workIDs2 = as.getWorks().getWorkGroup().get(0).getIdentifiers();
assertEquals("agr", workIDs.getExternalIdentifier().get(0).getType());
assertEquals("external-id-value", workIDs.getExternalIdentifier().get(0).getValue());
assertEquals(new Url("http://tempuri.org"), workIDs.getExternalIdentifier().get(0).getUrl());
assertEquals(Relationship.SELF, workIDs.getExternalIdentifier().get(0).getRelationship());
assertEquals(workIDs.getExternalIdentifier().get(0).getType(), workIDs2.getExternalIdentifier().get(0).getType());
assertEquals(workIDs.getExternalIdentifier().get(0).getValue(), workIDs2.getExternalIdentifier().get(0).getValue());
}
Aggregations