From cd33f6bc3285c0c1c0fd210ea60957f76b56a79a Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 18 Aug 2019 10:04:35 +0300 Subject: [PATCH] Disabled systems after all database tests --- .../src/test/java/com/djrapitops/plan/db/H2Test.java | 7 +++++++ .../src/test/java/com/djrapitops/plan/db/MySQLTest.java | 7 +++++++ .../src/test/java/com/djrapitops/plan/db/SQLiteTest.java | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/Plan/common/src/test/java/com/djrapitops/plan/db/H2Test.java b/Plan/common/src/test/java/com/djrapitops/plan/db/H2Test.java index 55ec5563d..753051ef5 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/db/H2Test.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/db/H2Test.java @@ -17,6 +17,7 @@ package com.djrapitops.plan.db; import com.djrapitops.plan.system.PlanSystem; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.TempDir; @@ -52,6 +53,12 @@ public class H2Test implements DatabaseTest { .orElseThrow(IllegalStateException::new); } + @AfterAll + static void disableSystem() { + if (database != null) database.close(); + system.disable(); + } + @Override public Database db() { return database; diff --git a/Plan/common/src/test/java/com/djrapitops/plan/db/MySQLTest.java b/Plan/common/src/test/java/com/djrapitops/plan/db/MySQLTest.java index d1e759a6a..702765e86 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/db/MySQLTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/db/MySQLTest.java @@ -20,6 +20,7 @@ import com.djrapitops.plan.data.container.GeoInfo; import com.djrapitops.plan.db.access.queries.ServerAggregateQueries; import com.djrapitops.plan.db.access.transactions.events.PlayerRegisterTransaction; import com.djrapitops.plan.system.PlanSystem; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -65,6 +66,12 @@ class MySQLTest implements DatabaseTest { database = mysql.get(); } + @AfterAll + static void disableSystem() { + if (database != null) database.close(); + system.disable(); + } + @Override public Database db() { return database; diff --git a/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java b/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java index b8c9e4624..acd9d7378 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java @@ -23,6 +23,7 @@ import com.djrapitops.plan.db.access.transactions.StoreServerInformationTransact import com.djrapitops.plan.db.access.transactions.events.PlayerRegisterTransaction; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.info.server.Server; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -62,6 +63,12 @@ public class SQLiteTest implements DatabaseTest { .orElseThrow(IllegalStateException::new); } + @AfterAll + static void disableSystem() { + if (database != null) database.close(); + system.disable(); + } + @Override public Database db() { return database;