use of org.neo4j.doc.kernel.impl.proc.JarBuilder in project neo4j-documentation by neo4j.
the class ProcedureExampleDocTest method listDenseNodesShouldWork.
@Test
void listDenseNodesShouldWork() throws Throwable {
// Given
new JarBuilder().createJarFor(directory.resolve("myProcedures.jar").toFile(), ProcedureExample.class);
managementService = new DatabaseManagementServiceBuilder(directory).setConfig(GraphDatabaseSettings.plugin_dir, directory.toAbsolutePath()).build();
db = managementService.database(DEFAULT_DATABASE_NAME);
try (Transaction transaction = db.beginTx()) {
Node node1 = transaction.createNode();
Node node2 = transaction.createNode();
Node node3 = transaction.createNode();
node1.createRelationshipTo(node1, RelationshipType.withName("KNOWS"));
node1.createRelationshipTo(node2, RelationshipType.withName("KNOWS"));
node1.createRelationshipTo(node3, RelationshipType.withName("KNOWS"));
// When
Result res = transaction.execute("CALL org.neo4j.examples.findDenseNodes(2)");
// Then
assertEquals(map("degree", 3L, "nodeId", node1.getId()), res.next());
assertFalse(res.hasNext());
}
}
Aggregations