diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index d0d95c0c8f81..3232c90cef06 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -21,8 +21,6 @@ updates:
interval: "daily"
ignore:
# Ignore all these until we move to JDK >= 21
- - dependency-name: 'org.apache.derby:*'
- versions: '>= 10.16'
- dependency-name: 'com.puppycrawl.tools:*'
versions: '>= 13'
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index e533ac739fe8..bb45678cd0cf 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -706,7 +706,7 @@ public Object run(ActionContext context) throws Exception {
if (jdbc) {
if (jdbcURL == null) {
- jdbcURL = "jdbc:derby:" + getInstance().getAbsolutePath() + "/data/derby/db;create=true";
+ jdbcURL = "jdbc:hsqldb:file:" + getInstance().getAbsolutePath() + "/data/hsqldb/db;hsqldb.write_delay=false";
}
filters.put("${jdbcBindings}", jdbcBindings);
filters.put("${jdbcMessages}", jdbcMessages);
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/database-store.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/database-store.txt
index 0b0cbff402c4..b8d2718ff5c5 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/database-store.txt
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/database-store.txt
@@ -3,7 +3,7 @@
+ We don't endorse any specific JDBC provider. HSQLDB is provided by default for demonstration purposes. -->
${jdbcClassName}
${jdbcURL}
${jdbcMessages}
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
index 80801e8f2d82..ef752b4087bf 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
@@ -464,11 +464,11 @@ public static String getDefaultHapolicyBackupStrategy() {
// Which store type to use, options are FILE or DATABASE, FILE is default.
private static String DEFAULT_STORE_TYPE = "FILE";
- // Default database url. Derby database is used by default.
+ // Default database url. HSQLDB is used by default.
private static String DEFAULT_DATABASE_URL = null;
- // Default JDBC Driver class name, derby by default just for demo purposes
- private static String DEFAULT_JDBC_DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver";
+ // Default JDBC Driver class name, HSQLDB by default just for demo purposes
+ private static String DEFAULT_JDBC_DRIVER_CLASS_NAME = "org.hsqldb.jdbc.JDBCDriver";
// Default JDBC Driver class name. DBCP2 BasicDataSource is used by default.
private static String DEFAULT_JDBC_DATA_SOURCE_CLASS_NAME = "org.apache.commons.dbcp2.BasicDataSource";
diff --git a/artemis-jdbc-store/pom.xml b/artemis-jdbc-store/pom.xml
index 6d09ffc8e4ea..5055295218b2 100644
--- a/artemis-jdbc-store/pom.xml
+++ b/artemis-jdbc-store/pom.xml
@@ -65,13 +65,8 @@
- org.apache.derby
- derby
- test
-
-
- org.apache.derby
- derbytools
+ org.hsqldb
+ hsqldb
test
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java
index 95d250c03f6f..a9d6323050f8 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java
@@ -18,13 +18,10 @@
import javax.sql.DataSource;
import java.sql.Connection;
-import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.artemis.jdbc.store.logging.LoggingConnection;
-import org.apache.activemq.artemis.jdbc.store.sql.PropertySQLProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
@@ -50,7 +47,6 @@ public JDBCConnectionProvider(DataSource dataSource, String user, String passwor
this.supportNetworkTimeout = true;
this.user = user;
this.password = password;
- addDerbyShutdownHook();
}
public synchronized Connection getConnection() throws SQLException {
@@ -91,32 +87,6 @@ public synchronized Connection getConnection() throws SQLException {
return connection;
}
- private static AtomicBoolean shutAdded = new AtomicBoolean(false);
-
- private static class ShutdownDerby extends Thread {
- @Override
- public void run() {
- try {
- DriverManager.getConnection("jdbc:derby:;shutdown=true");
- } catch (Exception e) { }
- }
-
- }
-
- public void addDerbyShutdownHook() {
- // Shutdown the derby if using the derby embedded driver.
- try (Connection connection = getConnection()) {
- PropertySQLProvider.Factory.SQLDialect sqlDialect = PropertySQLProvider.Factory.investigateDialect(connection);
- if (sqlDialect == PropertySQLProvider.Factory.SQLDialect.DERBY) {
- if (shutAdded.compareAndSet(false, true)) {
- Runtime.getRuntime().addShutdownHook(new ShutdownDerby());
- }
- }
- } catch (SQLException e) {
- logger.error(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e).toString());
- }
- }
-
public int getNetworkTimeoutMillis() {
return networkTimeoutMillis;
}
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
index af1ac7b73796..4c49f0518d35 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
@@ -223,6 +223,9 @@ public synchronized int sync() {
connection.setAutoCommit(false);
+ boolean batchInsertRecord = false;
+ boolean batchDeleteRecord = false;
+ boolean batchRollbackRecord = false;
for (JDBCJournalRecord record : recordRef) {
logger.trace("sync::preparing JDBC statement for {}", record);
@@ -232,11 +235,13 @@ public synchronized int sync() {
// Standard SQL Delete Record, Non transactional delete
deletedRecords.add(record.getId());
record.writeDeleteRecord(deleteJournalRecords);
+ batchDeleteRecord = true;
break;
case JDBCJournalRecord.ROLLBACK_RECORD:
// Roll back we remove all records associated with this TX ID. This query is always performed last.
deleteJournalTxRecords.setLong(1, record.getTxId());
deleteJournalTxRecords.addBatch();
+ batchRollbackRecord = true;
break;
case JDBCJournalRecord.COMMIT_RECORD:
// We perform all the deletes and add the commit record in the same Database TX
@@ -246,20 +251,29 @@ public synchronized int sync() {
deletedRecords.add(info.id);
deleteJournalRecords.setLong(1, info.id);
deleteJournalRecords.addBatch();
+ batchDeleteRecord = true;
}
record.writeRecord(insertJournalRecords);
+ batchInsertRecord = true;
committedTransactions.add(record.getTxId());
break;
default:
// Default we add a new record to the DB
record.writeRecord(insertJournalRecords);
+ batchInsertRecord = true;
break;
}
}
- insertJournalRecords.executeBatch();
- deleteJournalRecords.executeBatch();
- deleteJournalTxRecords.executeBatch();
+ if (batchInsertRecord) {
+ insertJournalRecords.executeBatch();
+ }
+ if (batchDeleteRecord) {
+ deleteJournalRecords.executeBatch();
+ }
+ if (batchRollbackRecord) {
+ deleteJournalTxRecords.executeBatch();
+ }
connection.commit();
logger.trace("JDBC commit worked");
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java
index ccf7caf6d2fb..126055799547 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java
@@ -328,10 +328,9 @@ public static final class Factory implements SQLProvider.Factory {
public enum SQLDialect {
ORACLE("oracle", "oracle"),
POSTGRESQL("postgresql", "postgres"),
- DERBY("derby", "derby"),
+ HSQL("hsql", "hsql", "hypersonic"),
MYSQL("mysql", "mysql", "mariadb"),
DB2("db2", "db2"),
- HSQL("hsql", "hsql", "hypersonic"),
H2("h2", "h2"),
MSSQL("mssql", "microsoft"),
SYBASE("jconnect", "jconnect");
diff --git a/artemis-jdbc-store/src/main/resources/journal-sql.properties b/artemis-jdbc-store/src/main/resources/journal-sql.properties
index a0958e3bb8fd..bc152e20d3c8 100644
--- a/artemis-jdbc-store/src/main/resources/journal-sql.properties
+++ b/artemis-jdbc-store/src/main/resources/journal-sql.properties
@@ -57,11 +57,10 @@ close-connection-on-shutdown=true
# none|lower|upper
table-names-case=none
-# Derby SQL statements
-close-connection-on-shutdown.derby=false
-create-file-table.derby=CREATE TABLE %s (ID BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA BLOB, PRIMARY KEY(ID))
-max-blob-size.derby=2147483647
-table-names-case.derby=upper
+# HSQLDB SQL statements
+create-file-table.hsql=CREATE TABLE IF NOT EXISTS %s (ID BIGINT GENERATED BY DEFAULT AS IDENTITY,FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA BLOB, PRIMARY KEY(ID))
+max-blob-size.hsql=2147483647
+table-names-case.hsql=upper
# PostgreSQL SQL statements
create-file-table.postgresql=CREATE TABLE %s (ID BIGSERIAL, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA OID, PRIMARY KEY(ID))
diff --git a/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryTest.java b/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryTest.java
index ea34283f8253..e0526637b836 100644
--- a/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryTest.java
+++ b/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryTest.java
@@ -22,7 +22,6 @@
import static org.junit.jupiter.api.Assertions.fail;
import java.nio.ByteBuffer;
-import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collection;
@@ -52,8 +51,9 @@
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameter;
import org.apache.activemq.artemis.tests.extensions.parameterized.Parameters;
import org.apache.activemq.artemis.tests.util.ArtemisTestCase;
+import org.apache.activemq.artemis.tests.util.DBSupportUtil;
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
-import org.apache.derby.jdbc.EmbeddedDriver;
+import org.hsqldb.jdbc.JDBCDriver;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestTemplate;
@@ -62,7 +62,7 @@
@ExtendWith(ParameterizedTestExtension.class)
public class JDBCSequentialFileFactoryTest extends ArtemisTestCase {
- private static String className = EmbeddedDriver.class.getCanonicalName();
+ private static String className = JDBCDriver.class.getCanonicalName();
private JDBCSequentialFileFactory factory;
@@ -89,12 +89,13 @@ public void setup() throws Exception {
if (useAuthentication) {
user = "testuser";
password = "testpassword";
- System.setProperty("derby.connection.requireAuthentication", "true");
- System.setProperty("derby.user." + user, password);
dataSourceProperties.put("username", user);
dataSourceProperties.put("password", password);
+ } else {
+ dataSourceProperties.put("username", "SA");
+ dataSourceProperties.put("password", "");
}
- dataSourceProperties.put("url", "jdbc:derby:target/data;create=true");
+ dataSourceProperties.put("url", "jdbc:hsqldb:mem:filetest");
dataSourceProperties.put("driverClassName", className);
String tableName = "FILES";
String jdbcDatasourceClass = ActiveMQDefaultConfiguration.getDefaultDataSourceClassName();
@@ -110,23 +111,17 @@ public void tearDown() throws Exception {
scheduledExecutorService.shutdown();
factory.destroy();
} finally {
- shutdownDerby();
+ shutdownHSQL();
}
}
- private void shutdownDerby() {
+ private void shutdownHSQL() {
try {
- if (useAuthentication) {
- DriverManager.getConnection("jdbc:derby:;shutdown=true", user, password);
- } else {
- DriverManager.getConnection("jdbc:derby:;shutdown=true");
- }
+ String hsqlUser = useAuthentication ? user : "SA";
+ String hsqlPassword = useAuthentication ? password : "";
+ DBSupportUtil.shutdownHSQL("jdbc:hsqldb:mem:filetest", hsqlUser, hsqlPassword);
} catch (Exception ignored) {
}
- if (useAuthentication) {
- System.clearProperty("derby.connection.requireAuthentication");
- System.clearProperty("derby.user." + user);
- }
}
@TestTemplate
diff --git a/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalLoaderCallbackTest.java b/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalLoaderCallbackTest.java
index 9764481d26e1..2e0257f9b23c 100644
--- a/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalLoaderCallbackTest.java
+++ b/artemis-jdbc-store/src/test/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalLoaderCallbackTest.java
@@ -19,7 +19,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.List;
@@ -27,7 +26,6 @@
import org.apache.activemq.artemis.core.journal.RecordInfo;
import org.apache.activemq.artemis.core.journal.TransactionFailureCallback;
import org.apache.activemq.artemis.tests.util.ArtemisTestCase;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
public class JDBCJournalLoaderCallbackTest extends ArtemisTestCase {
@@ -51,12 +49,4 @@ public void testAddDeleteRecord() throws Exception {
assertTrue(committedRecords.isEmpty());
}
- @AfterEach
- public void shutdownDerby() {
- try {
- DriverManager.getConnection("jdbc:derby:;shutdown=true");
- } catch (Exception ignored) {
- }
- }
-
}
diff --git a/artemis-pom/pom.xml b/artemis-pom/pom.xml
index 3094d8f0e3f3..a0e345a96563 100644
--- a/artemis-pom/pom.xml
+++ b/artemis-pom/pom.xml
@@ -123,16 +123,11 @@
- org.apache.derby
- derby
- ${apache.derby.version}
- test
-
-
- org.apache.derby
- derbytools
- ${apache.derby.version}
+ org.hsqldb
+ hsqldb
+ ${hsqldb.version}
test
+
org.eclipse.paho
diff --git a/artemis-server/pom.xml b/artemis-server/pom.xml
index e531803c838f..0ea7acb49b74 100644
--- a/artemis-server/pom.xml
+++ b/artemis-server/pom.xml
@@ -245,13 +245,8 @@
- org.apache.derby
- derby
- test
-
-
- org.apache.derby
- derbytools
+ org.hsqldb
+ hsqldb
test
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationFullTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationFullTest.java
index 3632565e2908..423350308301 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationFullTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationFullTest.java
@@ -517,8 +517,8 @@ public void testStoreConfiguration() {
assertEquals("FULL_LARGE_MESSAGES", dbStore.getLargeMessageTableName());
assertEquals("FULL_PAGE_STORE", dbStore.getPageStoreTableName());
assertEquals("FULL_NODE_MANAGER", dbStore.getNodeManagerStoreTableName());
- assertEquals("jdbc:derby:target/full-test-store;create=true", dbStore.getJdbcConnectionUrl());
- assertEquals("org.apache.derby.jdbc.EmbeddedDriver", dbStore.getJdbcDriverClassName());
+ assertEquals("jdbc:hsqldb:mem:full-test-store", dbStore.getJdbcConnectionUrl());
+ assertEquals("org.hsqldb.jdbc.JDBCDriver", dbStore.getJdbcDriverClassName());
assertEquals(30000, dbStore.getJdbcNetworkTimeout());
assertEquals(3000, dbStore.getJdbcLockRenewPeriodMillis());
assertEquals(20000, dbStore.getJdbcLockExpirationMillis());
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java
index f6c51c7ef27d..e9c69881cfd3 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java
@@ -70,7 +70,7 @@ public class HAPolicyConfigurationTest extends ServerTestBase {
public void tearDown() throws Exception {
super.tearDown();
- shutdownDerby();
+ shutdownEmbeddedDatabases();
}
@Test
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManagerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManagerTest.java
index f08486296e6c..0c451d0885ff 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManagerTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcNodeManagerTest.java
@@ -45,10 +45,6 @@ public static Collection
- org.apache.derby
- derby
- test
-
-
- org.apache.derby
- derbytools
+ org.hsqldb
+ hsqldb
test
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java
index 0c8de9d04ca1..aeb954a24528 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java
@@ -159,8 +159,8 @@ public static void removeMessageStore() {
if (System.getProperty("activemq.store.dir") != null) {
recursiveDelete(new File(System.getProperty("activemq.store.dir")));
}
- if (System.getProperty("derby.system.home") != null) {
- recursiveDelete(new File(System.getProperty("derby.system.home")));
+ if (System.getProperty("hsqldb.system.home") != null) {
+ recursiveDelete(new File(System.getProperty("hsqldb.system.home")));
}
}
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
index c9fc26875220..1891a993db17 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
@@ -126,8 +126,8 @@ public static void removeMessageStore() {
if (System.getProperty("activemq.store.dir") != null) {
recursiveDelete(new File(System.getProperty("activemq.store.dir")));
}
- if (System.getProperty("derby.system.home") != null) {
- recursiveDelete(new File(System.getProperty("derby.system.home")));
+ if (System.getProperty("hsqldb.system.home") != null) {
+ recursiveDelete(new File(System.getProperty("hsqldb.system.home")));
}
}
@@ -174,7 +174,7 @@ public static PersistenceAdapter setPersistenceAdapter(BrokerService broker,
switch (choice) {
case JDBC:
JDBCPersistenceAdapter jdbcPersistenceAdapter = new JDBCPersistenceAdapter();
- jdbcPersistenceAdapter.setUseLock(false); // rollback (at shutdown) on derby can take a long time with file io etc
+ jdbcPersistenceAdapter.setUseLock(false);
adapter = jdbcPersistenceAdapter;
break;
case KahaDB:
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
index b4a0fb579785..db8c71bd94a1 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
@@ -487,14 +487,14 @@ protected void setDBStoreType(Configuration configuration) {
configuration.setStoreConfiguration(createDefaultDatabaseStorageConfiguration());
}
- private boolean derbyDropped = false;
+ private boolean embeddedDBDropped = false;
- protected void dropDerby() throws Exception {
- DBSupportUtil.dropDerbyDatabase(getJDBCUser(), getJDBCPassword(), getEmbeddedDataBaseName());
+ protected void dropEmbeddedDatabases() throws Exception {
+ DBSupportUtil.dropHSQLDatabase(getTestJDBCConnectionUrl(), getJDBCUser(), getJDBCPassword());
}
- protected void shutdownDerby() throws SQLException {
- DBSupportUtil.shutdownDerby(getJDBCUser(), getJDBCPassword());
+ protected void shutdownEmbeddedDatabases() throws SQLException {
+ DBSupportUtil.shutdownHSQL(getTestJDBCConnectionUrl(), getJDBCUser(), getJDBCPassword());
}
protected DatabaseStorageConfiguration createDefaultDatabaseStorageConfiguration() {
@@ -503,14 +503,14 @@ protected DatabaseStorageConfiguration createDefaultDatabaseStorageConfiguration
/*
* The connectionURI could be passed into the testsuite as a system property (say you are testing against Oracle).
- * So, we only schedule the drop on Derby if we are using a derby memory database
+ * So, we only schedule the drop on HSQL if we are using an HSQL in-memory database
*/
- if (connectionURI.contains("derby") && connectionURI.contains("memory") && !derbyDropped) {
+ if (connectionURI.contains("hsqldb") && connectionURI.contains("mem") && !embeddedDBDropped) {
// some tests will reinitialize the server and call this method more than one time
// and we should only schedule one task
- derbyDropped = true;
- runAfterEx(this::dropDerby);
- runAfterEx(this::shutdownDerby);
+ embeddedDBDropped = true;
+ runAfterEx(this::dropEmbeddedDatabases);
+ runAfterEx(this::shutdownEmbeddedDatabases);
}
dbStorageConfiguration.setJdbcConnectionUrl(connectionURI);
dbStorageConfiguration.setBindingsTableName("BINDINGS");
@@ -784,23 +784,23 @@ protected final String getTestDir() {
}
protected String getEmbeddedDataBaseName() {
- return "memory:" + getTestDir();
+ return getTestDir();
}
protected String getTestJDBCConnectionUrl() {
- return System.getProperty("jdbc.connection.url", "jdbc:derby:" + getEmbeddedDataBaseName() + ";create=true");
+ return System.getProperty("jdbc.connection.url", "jdbc:hsqldb:mem:" + getEmbeddedDataBaseName());
}
protected String getJDBCClassName() {
- return System.getProperty("jdbc.driver.class", "org.apache.derby.jdbc.EmbeddedDriver");
+ return System.getProperty("jdbc.driver.class", "org.hsqldb.jdbc.JDBCDriver");
}
protected String getJDBCUser() {
- return System.getProperty("jdbc.user", null);
+ return System.getProperty("jdbc.user", "SA");
}
protected String getJDBCPassword() {
- return System.getProperty("jdbc.password", null);
+ return System.getProperty("jdbc.password", "");
}
protected final File getTestDirfile() {
diff --git a/tests/db-tests/README.md b/tests/db-tests/README.md
index 41d4c032973e..ca7785a0e9c9 100644
--- a/tests/db-tests/README.md
+++ b/tests/db-tests/README.md
@@ -4,7 +4,7 @@ This module runs tests against selected Databases.
There is one profile for each supported Database:
-- DB-derby-tests
+- DB-hsql-tests
- DB-postgres-tests
- DB-mysql-tests
- DB-mssql-tests
@@ -23,7 +23,7 @@ You can refer to the examples provided under `./scripts`. Please note that you a
You can pass the JDBC URI as a parameter using the following supported parameters:
-- `derby.uri`
+- `hsql.uri`
- `postgres.uri`
- `mysql.uri`
- `mssql.uri`
@@ -44,7 +44,7 @@ Also It is recommended to the database schema allocated exclusively to this test
One Artemis server is created for each supported database. After building, they will be available under ./target/${DATABASE}:
-- `./target/derby`
+- `./target/hsql`
- `./target/postgres`
- `./target/mysql`
- `./target/mssql`
diff --git a/tests/db-tests/pom.xml b/tests/db-tests/pom.xml
index 1e6194e730b4..a94e508992d9 100644
--- a/tests/db-tests/pom.xml
+++ b/tests/db-tests/pom.xml
@@ -29,7 +29,7 @@
${project.basedir}/../../
- -Dderby.load=${derby.load} -Dpostgres.load=${postgres.load} -Dpostgres.uri=${postgres.uri}
+ -Dhsql.load=${hsql.load} -Dpostgres.load=${postgres.load} -Dpostgres.uri=${postgres.uri}
-Dpostgres.class=${postgres.class} -Dmssql.load=${mssql.load} -Dmssql.uri=${mssql.uri}
-Dmssql.class=${mssql.class} -Dmysql.load=${mysql.load} -Dmysql.uri=${mysql.uri} -Dmysql.class=${mysql.class}
-Ddb2.load=${db2.load} -Ddb2.class=${db2.class} -Ddb2.uri=${db2.uri} -Doracle.load=${oracle.load}
@@ -39,7 +39,7 @@
-Ddistribution.lib="${activemq.basedir}/artemis-distribution/target/apache-artemis-${project.version}-bin/apache-artemis-${project.version}/lib"
- false
+ false
false
jdbc:db2://localhost:50000/artemis:user=db2inst1;password=artemis;
@@ -183,13 +183,8 @@
- org.apache.derby
- derby
- test
-
-
- org.apache.derby
- derbytools
+ org.hsqldb
+ hsqldb
test
@@ -230,22 +225,22 @@
test-compile
- create-derby
+ create-hsql
create
-Djava.net.preferIPv4Stack=true
- ${basedir}/target/derby
- ${basedir}/target/classes/servers/derby
+ ${basedir}/target/hsql
+ ${basedir}/target/classes/servers/hsql
true
--jdbc
--global-max-messages
100
--java-options
- -Dartemis.extra.libs=${basedir}/target/derby/jdbc-jars
+ -Dartemis.extra.libs=${basedir}/target/hsql/jdbc-jars
--java-options
-ea
@@ -253,17 +248,15 @@
test-compile
- create-derby-jdbc
+ create-hsql-jdbc
dependency-scan
- org.apache.derby:derby:${apache.derby.version}
- org.apache.derby:derbytools:${apache.derby.version}
- org.apache.derby:derbyshared:${apache.derby.version}
+ org.hsqldb:hsqldb:${hsqldb.version}
- ${basedir}/target/derby/jdbc-jars
+ ${basedir}/target/hsql/jdbc-jars
@@ -441,7 +434,7 @@
true
true
true
- true
+ true
true
@@ -487,9 +480,9 @@
- DB-derby-tests
+ DB-hsql-tests
- true
+ true
false
diff --git a/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/DropDBTest.java b/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/DropDBTest.java
index 07fd7b59d16e..1bfd4e43fb7d 100644
--- a/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/DropDBTest.java
+++ b/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/DropDBTest.java
@@ -44,12 +44,12 @@ public class DropDBTest extends ParameterDBTestBase {
@Parameters(name = "db={0}")
public static Collection