use of org.neo4j.test.DbRepresentation in project neo4j by neo4j.
the class IncrementalBackupTests method createTransactiongWithWeirdRelationshipGroupRecord.
private DbRepresentation createTransactiongWithWeirdRelationshipGroupRecord(File path) {
db = startGraphDatabase(path);
int i = 0;
Node node;
DynamicRelationshipType typeToDelete = DynamicRelationshipType.withName("A");
DynamicRelationshipType theOtherType = DynamicRelationshipType.withName("B");
int defaultDenseNodeThreshold = Integer.parseInt(GraphDatabaseSettings.dense_node_threshold.getDefaultValue());
try (Transaction tx = db.beginTx()) {
node = db.createNode();
for (; i < defaultDenseNodeThreshold - 1; i++) {
node.createRelationshipTo(db.createNode(), theOtherType);
}
node.createRelationshipTo(db.createNode(), typeToDelete);
tx.success();
}
try (Transaction tx = db.beginTx()) {
node.createRelationshipTo(db.createNode(), theOtherType);
for (Relationship relationship : node.getRelationships(Direction.BOTH, typeToDelete)) {
relationship.delete();
}
tx.success();
}
DbRepresentation result = DbRepresentation.of(db);
db.shutdown();
return result;
}
use of org.neo4j.test.DbRepresentation in project neo4j by neo4j.
the class TestReadOnlyNeo4j method createSomeData.
private DbRepresentation createSomeData() {
RelationshipType type = withName("KNOWS");
GraphDatabaseService db = new TestGraphDatabaseFactory().setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs.get())).newImpermanentDatabase(PATH);
try (Transaction tx = db.beginTx()) {
Node prevNode = db.createNode();
for (int i = 0; i < 100; i++) {
Node node = db.createNode();
Relationship rel = prevNode.createRelationshipTo(node, type);
node.setProperty("someKey" + i % 10, i % 15);
rel.setProperty("since", System.currentTimeMillis());
}
tx.success();
}
DbRepresentation result = DbRepresentation.of(db);
db.shutdown();
return result;
}
Aggregations