From 1e340aff5ac383817e68cf837072869a7b7f335f Mon Sep 17 00:00:00 2001 From: Dmitriy Tverdiakov <11927660+injectives@users.noreply.github.com> Date: Tue, 28 Sep 2021 18:42:23 +0100 Subject: [PATCH] Add server shutdown to DatabaseExtension (#1022) --- .../org/neo4j/driver/util/DatabaseExtension.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/driver/src/test/java/org/neo4j/driver/util/DatabaseExtension.java b/driver/src/test/java/org/neo4j/driver/util/DatabaseExtension.java index c73f85b4ac..49c6cd5e4b 100644 --- a/driver/src/test/java/org/neo4j/driver/util/DatabaseExtension.java +++ b/driver/src/test/java/org/neo4j/driver/util/DatabaseExtension.java @@ -18,6 +18,7 @@ */ package org.neo4j.driver.util; +import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -41,7 +42,7 @@ import static org.neo4j.driver.util.Neo4jSettings.DEFAULT_TLS_CERT_PATH; import static org.neo4j.driver.util.Neo4jSettings.DEFAULT_TLS_KEY_PATH; -public class DatabaseExtension implements BeforeEachCallback +public class DatabaseExtension implements BeforeEachCallback, AfterAllCallback { static final String TEST_RESOURCE_FOLDER_PATH = "src/test/resources"; @@ -66,6 +67,15 @@ public void beforeEach( ExtensionContext context ) throws Exception TestUtil.cleanDb( driver() ); } + @Override + public void afterAll( ExtensionContext context ) + { + if ( runner != null ) + { + runner.stopNeo4j(); + } + } + public Driver driver() { return runner.driver();