From ea06fd66806102fb9790b336afc9770091de3767 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Sun, 27 Sep 2026 08:56:36 +0000
Subject: [PATCH] [#1075] Test the JDBC guards against a neighbouring MySQL database and Oracle schema (#1108)

---
 opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
index f3b3500..d22681d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
@@ -97,6 +97,12 @@
 				throw new SkipException(getContainerDockerCommand());
 			}
 		}
+		try {
+			dropStaleNeighbours();
+		} catch (SQLException e) {
+			// nothing left behind to drop, or an account the suite cannot log in with: either way the
+			// listing below decides, and it fails only where such a leftover is actually there
+		}
 		try(Connection con = DriverManager.getConnection(createBackendCfg().getDBDirectory())){
 			dropStaleTrees(con);
 		} catch (Exception e) {
@@ -135,6 +141,18 @@
 		}
 	}
 
+	/**
+	 * Drops what a case of a suite made outside the database or the schema of its own connections - a
+	 * neighbouring directory of the same table names - where a run killed in the middle of that case left
+	 * it behind. It goes before {@link #dropStaleTrees}, whose listing reaches such a table and whose drop
+	 * then fails - unqualified on mysql, where the table is in another database, and without the privilege
+	 * on oracle, where it is another user's - skipping the whole class on every run after it. A container
+	 * the suite starts is a fresh one; the database of {@link #getContainerDockerCommand()}, which a run
+	 * without docker falls back on, outlives every run made against it.
+	 */
+	protected void dropStaleNeighbours() throws SQLException {
+	}
+
 	@Override
 	protected Backend createBackend() {
 		return new Backend();

--
Gitblit v1.10.0