use of org.orcid.jaxb.model.record_rc4.Record in project neo4j by neo4j.
the class BoltCausalClusteringIT method executeWriteAndReadThroughBolt.
private int executeWriteAndReadThroughBolt(CoreClusterMember core) throws TimeoutException, InterruptedException {
try (Driver driver = GraphDatabase.driver(core.routingURI(), AuthTokens.basic("neo4j", "neo4j"))) {
return inExpirableSession(driver, (d) -> d.session(AccessMode.WRITE), (session) -> {
// when
session.run("MERGE (n:Person {name: 'Jim'})").consume();
Record record = session.run("MATCH (n:Person) RETURN COUNT(*) AS count").next();
return record.get("count").asInt();
});
}
}
use of org.orcid.jaxb.model.record_rc4.Record in project neo4j by neo4j.
the class BoltCausalClusteringIT method bookmarksShouldWorkWithDriverPinnedToSingleServer.
// Ensure that Bookmarks work with single instances using a driver created using a bolt[not+routing] URI.
@Test
public void bookmarksShouldWorkWithDriverPinnedToSingleServer() throws Exception {
// given
cluster = clusterRule.withNumberOfReadReplicas(1).startCluster();
CoreClusterMember leader = cluster.awaitLeader();
try (Driver driver = GraphDatabase.driver(leader.directURI(), AuthTokens.basic("neo4j", "neo4j"))) {
String bookmark = inExpirableSession(driver, Driver::session, (session) -> {
try (Transaction tx = session.beginTransaction()) {
tx.run("CREATE (p:Person {name: {name} })", Values.parameters("name", "Alistair"));
tx.success();
}
return session.lastBookmark();
});
assertNotNull(bookmark);
try (Session session = driver.session();
Transaction tx = session.beginTransaction(bookmark)) {
Record record = tx.run("MATCH (n:Person) RETURN COUNT(*) AS count").next();
assertEquals(1, record.get("count").asInt());
tx.success();
}
}
}
use of org.orcid.jaxb.model.record_rc4.Record in project neo4j by neo4j.
the class BoltCausalClusteringIT method shouldUseBookmarkFromAReadSessionInAWriteSession.
@Test
public void shouldUseBookmarkFromAReadSessionInAWriteSession() throws Exception {
// given
cluster = clusterRule.withNumberOfReadReplicas(1).startCluster();
CoreClusterMember leader = cluster.awaitLeader();
try (Driver driver = GraphDatabase.driver(leader.directURI(), AuthTokens.basic("neo4j", "neo4j"))) {
inExpirableSession(driver, (d) -> d.session(AccessMode.WRITE), (session) -> {
session.run("CREATE (p:Person {name: {name} })", Values.parameters("name", "Jim"));
return null;
});
String bookmark;
try (Session session = driver.session(AccessMode.READ)) {
try (Transaction tx = session.beginTransaction()) {
tx.run("MATCH (n:Person) RETURN COUNT(*) AS count").next();
tx.success();
}
bookmark = session.lastBookmark();
}
assertNotNull(bookmark);
inExpirableSession(driver, (d) -> d.session(AccessMode.WRITE), (session) -> {
try (Transaction tx = session.beginTransaction(bookmark)) {
tx.run("CREATE (p:Person {name: {name} })", Values.parameters("name", "Alistair"));
tx.success();
}
return null;
});
try (Session session = driver.session()) {
Record record = session.run("MATCH (n:Person) RETURN COUNT(*) AS count").next();
assertEquals(2, record.get("count").asInt());
}
}
}
use of org.orcid.jaxb.model.record_rc4.Record in project neo4j by neo4j.
the class BoltCausalClusteringIT method executeReadQuery.
private void executeReadQuery(String bookmark, Session session) {
try (Transaction tx = session.beginTransaction(bookmark)) {
Record record = tx.run("MATCH (n:Person) RETURN COUNT(*) AS count").next();
assertEquals(1, record.get("count").asInt());
}
}
use of org.orcid.jaxb.model.record_rc4.Record in project ORCID-Source by ORCID.
the class RecordManagerTest method testGetRecord.
@Test
public void testGetRecord() {
Record record = RecordManager.getRecord(ORCID);
assertNotNull(record);
assertNotNull(record.getActivitiesSummary());
assertNotNull(record.getPerson());
Person person = record.getPerson();
assertNotNull(person.getExternalIdentifiers());
assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers());
assertEquals(5, person.getExternalIdentifiers().getExternalIdentifiers().size());
assertNotNull(person.getResearcherUrls());
assertNotNull(person.getResearcherUrls().getResearcherUrls());
assertEquals(5, person.getResearcherUrls().getResearcherUrls().size());
assertNotNull(person.getOtherNames());
assertNotNull(person.getOtherNames().getOtherNames());
assertEquals(5, person.getOtherNames().getOtherNames().size());
assertNotNull(person.getAddresses());
assertNotNull(person.getAddresses().getAddress());
assertEquals(5, person.getAddresses().getAddress().size());
assertNotNull(person.getKeywords());
assertNotNull(person.getKeywords().getKeywords());
assertEquals(5, person.getKeywords().getKeywords().size());
assertNotNull(person.getEmails());
assertNotNull(person.getEmails().getEmails());
assertEquals(5, person.getEmails().getEmails().size());
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);
assertNotNull(activities.getEducations());
assertNotNull(activities.getEducations().getSummaries());
assertEquals(5, activities.getEducations().getSummaries().size());
assertNotNull(activities.getEmployments());
assertNotNull(activities.getEmployments().getSummaries());
assertEquals(5, activities.getEmployments().getSummaries().size());
assertNotNull(activities.getFundings());
assertNotNull(activities.getFundings().getFundingGroup());
assertEquals(5, activities.getFundings().getFundingGroup().size());
assertNotNull(activities.getPeerReviews());
assertNotNull(activities.getPeerReviews().getPeerReviewGroup());
assertEquals(5, activities.getPeerReviews().getPeerReviewGroup().size());
assertNotNull(activities.getWorks());
assertNotNull(activities.getWorks().getWorkGroup());
assertEquals(5, activities.getWorks().getWorkGroup().size());
}
Aggregations