On 28/11/2024 09:22, Rémy Maucherat wrote:
On Thu, Nov 28, 2024 at 10:11 AM <ma...@apache.org> wrote:
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 5970fa4b6c Avoid conflicts over derby.log when tests are run in
parallel
5970fa4b6c is described below
Thanks for finding the proper way to do it.
I appreciate the thanks but it felt a bit of a hack. I'd rather have set
the system property just in the tests that used Derby but that would
have required more invasive changes to expose the temporary directory
via a static rather than instance method.
Maybe I should do that refactoring. We don't need to worry about
backwards compatibility for the API for the tests.
Mark
Rémy
commit 5970fa4b6cc89e1d4a8c3b0ddf1c718f5b495099
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Nov 28 09:08:38 2024 +0000
Avoid conflicts over derby.log when tests are run in parallel
---
test/org/apache/catalina/realm/TestDataSourceRealm.java | 7 -------
test/org/apache/catalina/startup/LoggingBaseTest.java | 1 +
test/org/apache/catalina/users/TestDataSourceUserDatabase.java | 7 -------
3 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/test/org/apache/catalina/realm/TestDataSourceRealm.java
b/test/org/apache/catalina/realm/TestDataSourceRealm.java
index 57486a54c9..bdd1af6972 100644
--- a/test/org/apache/catalina/realm/TestDataSourceRealm.java
+++ b/test/org/apache/catalina/realm/TestDataSourceRealm.java
@@ -16,7 +16,6 @@
*/
package org.apache.catalina.realm;
-import java.io.File;
import java.security.Principal;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -24,7 +23,6 @@ import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
-import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
@@ -87,11 +85,6 @@ public class TestDataSourceRealm extends LoggingBaseTest {
private DerbyDataSourceRealm db;
- @AfterClass
- public static void derbyCleanup() {
- System.out.println("Deleted derby.log: " + (new
File("derby.log")).delete());
- }
-
@Test
public void testRealm() throws Exception {
diff --git a/test/org/apache/catalina/startup/LoggingBaseTest.java
b/test/org/apache/catalina/startup/LoggingBaseTest.java
index 200978c92f..8a96e41436 100644
--- a/test/org/apache/catalina/startup/LoggingBaseTest.java
+++ b/test/org/apache/catalina/startup/LoggingBaseTest.java
@@ -115,6 +115,7 @@ public abstract class LoggingBaseTest {
tempDir = Files.createTempDirectory(tempBasePath, "test").toFile();
System.setProperty(Constants.CATALINA_BASE_PROP,
tempDir.getAbsolutePath());
+ System.setProperty("derby.system.home", tempDir.getAbsolutePath());
// Configure logging
System.setProperty("java.util.logging.manager",
diff --git a/test/org/apache/catalina/users/TestDataSourceUserDatabase.java
b/test/org/apache/catalina/users/TestDataSourceUserDatabase.java
index 56e5458472..c331cb353d 100644
--- a/test/org/apache/catalina/users/TestDataSourceUserDatabase.java
+++ b/test/org/apache/catalina/users/TestDataSourceUserDatabase.java
@@ -16,13 +16,11 @@
*/
package org.apache.catalina.users;
-import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Iterator;
-import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
@@ -111,11 +109,6 @@ public class TestDataSourceUserDatabase extends
LoggingBaseTest {
private DerbyUserDatabase db;
- @AfterClass
- public static void derbyCleanup() {
- System.out.println("Deleted derby.log: " + (new
File("derby.log")).delete());
- }
-
@Test
public void testBasicUserRoleDatabase()
throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org