Search in sources :

Example 6 with DatabaseShutdownException

use of org.neo4j.graphdb.DatabaseShutdownException in project neo4j by neo4j.

the class TestNeo4jApiExceptions method shouldGiveNiceErrorWhenShutdownKernelApi.

@Test
public void shouldGiveNiceErrorWhenShutdownKernelApi() {
    GraphDatabaseService graphDb = graph;
    Node node = graphDb.createNode();
    commit();
    graphDb.shutdown();
    try {
        asList(node.getLabels().iterator());
        fail("Did not get a nice exception");
    } catch (DatabaseShutdownException e) {
    // good
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) Node(org.neo4j.graphdb.Node) DatabaseShutdownException(org.neo4j.graphdb.DatabaseShutdownException) Test(org.junit.Test)

Aggregations

DatabaseShutdownException (org.neo4j.graphdb.DatabaseShutdownException)6 Test (org.junit.Test)3 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)3 Node (org.neo4j.graphdb.Node)3 Transaction (org.neo4j.graphdb.Transaction)2 TransactionFailureException (org.neo4j.graphdb.TransactionFailureException)2 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 CoreGraphDatabase (org.neo4j.causalclustering.core.CoreGraphDatabase)1 NoLeaderFoundException (org.neo4j.causalclustering.core.consensus.NoLeaderFoundException)1 IdGenerationException (org.neo4j.causalclustering.core.state.machines.id.IdGenerationException)1 WriteOperationsNotAllowedException (org.neo4j.graphdb.security.WriteOperationsNotAllowedException)1 AcquireLockTimeoutException (org.neo4j.storageengine.api.lock.AcquireLockTimeoutException)1 DbRepresentation (org.neo4j.test.DbRepresentation)1