@Test public void whenNoNodes_unhealty() throws Exception { GraphDatabaseService graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase(); Neo4jHealthCheck healthCheck = new Neo4jHealthCheck(graphDb); assertThat(healthCheck.check().isHealthy(), is(false)); graphDb.shutdown(); }
@Override protected Result check() throws Exception { int count = 0; try (Transaction tx = graphDb.beginTx()) { count = size(graphDb.getAllNodes()); tx.success(); } if (count > 0) { return Result.healthy(); } else { return Result.unhealthy("There are no nodes in the graph."); } }
Neo4jHealthCheck extends NamedHealthCheck { @Override protected Result check() throws Exception { int count = 0; try (Transaction tx = graphDb.beginTx()) { count = size(graphDb.getAllNodes()); tx.success(); } if (count > 0) { return Result.healthy(); } else { return Result.unhealthy("There are no nodes in the graph."); } } }
Neo4jHealthCheck extends NamedHealthCheck { @Override protected Result check() throws Exception { int count = 0; try (Transaction tx = graphDb.beginTx()) { count = size(graphDb.getAllNodes()); tx.success(); } if (count > 0) { return Result.healthy(); } else { return Result.unhealthy("There are no nodes in the graph."); } } @Inject  Neo4jHealthCheck(GraphDatabaseService graphDb); }
Neo4jHealthCheck extends NamedHealthCheck { @Override protected Result check() throws Exception { int count = 0; try (Transaction tx = graphDb.beginTx()) { count = size(graphDb.getAllNodes()); tx.success(); } if (count > 0) { return Result.healthy(); } else { return Result.unhealthy("There are no nodes in the graph."); } } @Inject  Neo4jHealthCheck(GraphDatabaseService graphDb); @Override String getName(); }
Neo4jHealthCheck extends NamedHealthCheck { @Override protected Result check() throws Exception { int count = 0; try (Transaction tx = graphDb.beginTx()) { count = size(graphDb.getAllNodes()); tx.success(); } if (count > 0) { return Result.healthy(); } else { return Result.unhealthy("There are no nodes in the graph."); } } @Inject  Neo4jHealthCheck(GraphDatabaseService graphDb); @Override String getName();  }