diff --git a/FROST-Server.Tests/pom.xml b/FROST-Server.Tests/pom.xml
index b74618917..7ad98d40d 100644
--- a/FROST-Server.Tests/pom.xml
+++ b/FROST-Server.Tests/pom.xml
@@ -179,6 +179,12 @@
junit-jupiter
test
+
+ org.testcontainers
+ mariadb
+ 1.20.3
+ test
+
org.testcontainers
postgresql
diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/TestSuite.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/TestSuite.java
index 78c03c412..3e42be0e0 100644
--- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/TestSuite.java
+++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/TestSuite.java
@@ -17,7 +17,13 @@
*/
package de.fraunhofer.iosb.ilt.statests;
+import static de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.utils.ConnectionUtils.TAG_DB_DRIVER;
+import static de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.utils.ConnectionUtils.TAG_DB_PASSWRD;
+import static de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.utils.ConnectionUtils.TAG_DB_URL;
+import static de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.utils.ConnectionUtils.TAG_DB_USERNAME;
+import static de.fraunhofer.iosb.ilt.frostserver.settings.CoreSettings.PREFIX_PERSISTENCE;
import static de.fraunhofer.iosb.ilt.frostserver.settings.CoreSettings.PREFIX_PLUGINS;
+import static de.fraunhofer.iosb.ilt.frostserver.settings.PersistenceSettings.TAG_AUTO_UPDATE_DATABASE;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.fail;
@@ -31,6 +37,7 @@
import de.fraunhofer.iosb.ilt.frostserver.settings.BusSettings;
import de.fraunhofer.iosb.ilt.frostserver.settings.CoreSettings;
import de.fraunhofer.iosb.ilt.frostserver.settings.MqttSettings;
+import de.fraunhofer.iosb.ilt.frostserver.settings.PersistenceSettings;
import de.fraunhofer.iosb.ilt.frostserver.util.Constants;
import de.fraunhofer.iosb.ilt.statests.c01sensingcore.Capability1CoreOnlyTests10;
import de.fraunhofer.iosb.ilt.statests.c01sensingcore.Capability1CoreOnlyTests11;
@@ -196,7 +203,8 @@ public class TestSuite {
public static final String KEY_DB_NAME = "dbName";
public static final String VAL_PERSISTENCE_MANAGER = "de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.PostgresPersistenceManager";
- public static final String VAL_ID_TYPE_DEFAULT = Constants.VALUE_ID_TYPE_UUID;
+ public static final String VAL_ID_TYPE_DEFAULT = Constants.VALUE_ID_TYPE_LONG;
+ public static final String VAL_ID_TYPE_LOCATIONS = Constants.VALUE_ID_TYPE_UUID;
public static final String VAL_ID_TYPE_OBSERVATIONS = Constants.VALUE_ID_TYPE_LONG;
public static final String VAL_ID_TYPE_OBSERVEDPROPERTIES = Constants.VALUE_ID_TYPE_LONG;
public static final String VAL_ID_TYPE_HIST_LOCATIONS = Constants.VALUE_ID_TYPE_LONG;
@@ -204,8 +212,10 @@ public class TestSuite {
public static final String VAL_PG_USER = "sensorthings";
public static final String VAL_PG_PASS = "ChangeMe";
- private static final String DATABASE_CONNECT_URL_BASE = "jdbc:tc:postgis:14-3.2:///";
- private static final String DATABASE_CONNECT_URL_POSTFIX = "?TC_DAEMON=true&TC_INITSCRIPT=file:src/test/resources/pgInit.sql";
+ private static final String DB_PG_CONNECT_URL_BASE = "jdbc:tc:postgis:14-3.2:///";
+ private static final String DB_PG_CONNECT_URL_POSTFIX = "?TC_DAEMON=true&TC_INITSCRIPT=file:src/test/resources/pgInit.sql";
+ private static final String DB_MARIADB_CONNECT_URL_BASE = "jdbc:tc:mariadb:11.5.2:///";
+ private static final String DB_MARIADB_CONNECT_URL_POSTFIX = "?TC_DAEMON=true";
private static TestSuite instance;
@@ -361,16 +371,18 @@ private void startHttpServer(int key, Map parameters) {
handler.setInitParameter(CoreSettings.TAG_TEMP_PATH, System.getProperty("java.io.tmpdir"));
handler.setInitParameter(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_DEFAULT, VAL_ID_TYPE_DEFAULT);
+ handler.setInitParameter(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_LOCATION, VAL_ID_TYPE_LOCATIONS);
handler.setInitParameter(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_OBSERVATION, VAL_ID_TYPE_OBSERVATIONS);
handler.setInitParameter(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_OBS_PROPERTY, VAL_ID_TYPE_OBSERVEDPROPERTIES);
handler.setInitParameter(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_HIST_LOCATION, VAL_ID_TYPE_HIST_LOCATIONS);
- handler.setInitParameter("persistence.persistenceManagerImplementationClass", VAL_PERSISTENCE_MANAGER);
- handler.setInitParameter("persistence.autoUpdateDatabase", "true");
- handler.setInitParameter("persistence.db.driver", "org.postgresql.Driver");
- handler.setInitParameter("persistence.db.url", createDbUrl(parameters.get(KEY_DB_NAME)));
- handler.setInitParameter("persistence.db.username", VAL_PG_USER);
- handler.setInitParameter("persistence.db.password", VAL_PG_PASS);
+ String dbDriver = paramsMap.computeIfAbsent(PREFIX_PERSISTENCE + TAG_DB_DRIVER, t -> "org.postgresql.Driver");
+ handler.setInitParameter(PREFIX_PERSISTENCE + PersistenceSettings.TAG_IMPLEMENTATION_CLASS, VAL_PERSISTENCE_MANAGER);
+ handler.setInitParameter(PREFIX_PERSISTENCE + TAG_AUTO_UPDATE_DATABASE, "true");
+ handler.setInitParameter(PREFIX_PERSISTENCE + TAG_DB_DRIVER, dbDriver);
+ handler.setInitParameter(PREFIX_PERSISTENCE + TAG_DB_URL, createDbUrl(dbDriver, parameters.get(KEY_DB_NAME)));
+ handler.setInitParameter(PREFIX_PERSISTENCE + TAG_DB_USERNAME, VAL_PG_USER);
+ handler.setInitParameter(PREFIX_PERSISTENCE + TAG_DB_PASSWRD, VAL_PG_PASS);
handler.setInitParameter("bus." + BusSettings.TAG_IMPLEMENTATION_CLASS, "de.fraunhofer.iosb.ilt.frostserver.messagebus.MqttMessageBus");
handler.setInitParameter("bus." + MqttMessageBus.TAG_MQTT_BROKER, "tcp://" + mqttBus.getHost() + ":" + mqttBus.getFirstMappedPort());
@@ -399,8 +411,12 @@ private void startHttpServer(int key, Map parameters) {
serverSetting.initExtensionsAndTypes();
}
- public static String createDbUrl(String dbName) {
- return DATABASE_CONNECT_URL_BASE + dbName + DATABASE_CONNECT_URL_POSTFIX;
+ public static String createDbUrl(String type, String dbName) {
+ if (type.toLowerCase().contains("mariadb")) {
+ return DB_MARIADB_CONNECT_URL_BASE + dbName + DB_MARIADB_CONNECT_URL_POSTFIX;
+ } else {
+ return DB_PG_CONNECT_URL_BASE + dbName + DB_PG_CONNECT_URL_POSTFIX;
+ }
}
private void startMqttServer(int key, Map parameters) throws IOException {
@@ -429,15 +445,18 @@ private void startMqttServer(int key, Map parameters) throws IOE
properties.put("mqtt.WebsocketPort", "" + mqttWsPort);
properties.put(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_DEFAULT, VAL_ID_TYPE_DEFAULT);
+ properties.put(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_LOCATION, VAL_ID_TYPE_LOCATIONS);
properties.put(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_OBSERVATION, VAL_ID_TYPE_OBSERVATIONS);
properties.put(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_OBS_PROPERTY, VAL_ID_TYPE_OBSERVEDPROPERTIES);
properties.put(PREFIX_PLUGINS + CoreModelSettings.TAG_ID_TYPE_HIST_LOCATION, VAL_ID_TYPE_HIST_LOCATIONS);
- properties.put("persistence.persistenceManagerImplementationClass", VAL_PERSISTENCE_MANAGER);
- properties.put("persistence.db.driver", "org.postgresql.Driver");
- properties.put("persistence.db.url", createDbUrl(parameters.get(KEY_DB_NAME)));
- properties.put("persistence.db.username", VAL_PG_USER);
- properties.put("persistence.db.password", VAL_PG_PASS);
+ String dbDriver = parameters.getOrDefault(PREFIX_PERSISTENCE + TAG_DB_DRIVER, "org.postgresql.Driver");
+ properties.put(PREFIX_PERSISTENCE + PersistenceSettings.TAG_IMPLEMENTATION_CLASS, VAL_PERSISTENCE_MANAGER);
+ properties.put(PREFIX_PERSISTENCE + TAG_AUTO_UPDATE_DATABASE, "true");
+ properties.put(PREFIX_PERSISTENCE + TAG_DB_DRIVER, dbDriver);
+ properties.put(PREFIX_PERSISTENCE + TAG_DB_URL, createDbUrl(dbDriver, parameters.get(KEY_DB_NAME)));
+ properties.put(PREFIX_PERSISTENCE + TAG_DB_USERNAME, VAL_PG_USER);
+ properties.put(PREFIX_PERSISTENCE + TAG_DB_PASSWRD, VAL_PG_PASS);
properties.put("bus." + BusSettings.TAG_IMPLEMENTATION_CLASS, "de.fraunhofer.iosb.ilt.frostserver.messagebus.MqttMessageBus");
properties.put("bus." + MqttMessageBus.TAG_MQTT_BROKER, "tcp://" + mqttBus.getHost() + ":" + mqttBus.getFirstMappedPort());
properties.putAll(parameters);
diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthAnonReadTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthAnonReadTests.java
index c8c06246f..580a192af 100644
--- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthAnonReadTests.java
+++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthAnonReadTests.java
@@ -47,8 +47,9 @@ public abstract class BasicAuthAnonReadTests extends AbstractAuthTests {
SERVER_PROPERTIES.put("auth.allowAnonymousRead", "true");
SERVER_PROPERTIES.put("auth.autoUpdateDatabase", "true");
final String dbName = "basicauth";
- SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbName));
- SERVER_PROPERTIES.put("auth.db.driver", "org.postgresql.Driver");
+ final String dbDriver = "org.postgresql.Driver";
+ SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbDriver, dbName));
+ SERVER_PROPERTIES.put("auth.db.driver", dbDriver);
SERVER_PROPERTIES.put("auth.db.username", TestSuite.VAL_PG_USER);
SERVER_PROPERTIES.put("auth.db.password", TestSuite.VAL_PG_PASS);
SERVER_PROPERTIES.put(KEY_DB_NAME, dbName);
diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthCryptPwTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthCryptPwTests.java
index 6c0d97594..cd3e9c2d7 100644
--- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthCryptPwTests.java
+++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthCryptPwTests.java
@@ -48,8 +48,9 @@ public abstract class BasicAuthCryptPwTests extends AbstractAuthTests {
SERVER_PROPERTIES.put("auth.autoUpdateDatabase", "true");
SERVER_PROPERTIES.put("auth.plainTextPassword", "false");
final String dbName = "hashauth";
- SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbName));
- SERVER_PROPERTIES.put("auth.db.driver", "org.postgresql.Driver");
+ final String dbDriver = "org.postgresql.Driver";
+ SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbDriver, dbName));
+ SERVER_PROPERTIES.put("auth.db.driver", dbDriver);
SERVER_PROPERTIES.put("auth.db.username", TestSuite.VAL_PG_USER);
SERVER_PROPERTIES.put("auth.db.password", TestSuite.VAL_PG_PASS);
SERVER_PROPERTIES.put(KEY_DB_NAME, dbName);
diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthTests.java
index 5cd35132e..c3076a9e3 100644
--- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthTests.java
+++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/BasicAuthTests.java
@@ -46,8 +46,9 @@ public abstract class BasicAuthTests extends AbstractAuthTests {
SERVER_PROPERTIES.put("auth.allowAnonymousRead", "false");
SERVER_PROPERTIES.put("auth.autoUpdateDatabase", "true");
final String dbName = "basicauth";
- SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbName));
- SERVER_PROPERTIES.put("auth.db.driver", "org.postgresql.Driver");
+ final String dbDriver = "org.postgresql.Driver";
+ SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbDriver, dbName));
+ SERVER_PROPERTIES.put("auth.db.driver", dbDriver);
SERVER_PROPERTIES.put("auth.db.username", TestSuite.VAL_PG_USER);
SERVER_PROPERTIES.put("auth.db.password", TestSuite.VAL_PG_PASS);
SERVER_PROPERTIES.put(KEY_DB_NAME, dbName);
diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsBasic.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsBasic.java
index 206479b4f..1d73f9d24 100644
--- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsBasic.java
+++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsBasic.java
@@ -63,8 +63,9 @@ public class FineGrainedAuthTestsBasic extends FineGrainedAuthTests {
SERVER_PROPERTIES.put("auth.allowAnonymousRead", "false");
SERVER_PROPERTIES.put("auth.autoUpdateDatabase", "true");
final String dbName = "fineGrainedAuthBasic";
- SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbName));
- SERVER_PROPERTIES.put("auth.db.driver", "org.postgresql.Driver");
+ final String dbDriver = "org.postgresql.Driver";
+ SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbDriver, dbName));
+ SERVER_PROPERTIES.put("auth.db.driver", dbDriver);
SERVER_PROPERTIES.put("auth.db.username", TestSuite.VAL_PG_USER);
SERVER_PROPERTIES.put("auth.db.password", TestSuite.VAL_PG_PASS);
SERVER_PROPERTIES.put("auth.plainTextPassword", "false");
diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsKeycloak.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsKeycloak.java
index c21d8c277..d2c941fa4 100644
--- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsKeycloak.java
+++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTestsKeycloak.java
@@ -52,8 +52,9 @@ public class FineGrainedAuthTestsKeycloak extends FineGrainedAuthTests {
static {
FineGrainedAuthTests.addCommonProperties(SERVER_PROPERTIES);
final String dbName = "fineGrainedAuthKeycloak";
- SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbName));
- SERVER_PROPERTIES.put("auth.db.driver", "org.postgresql.Driver");
+ final String dbDriver = "org.postgresql.Driver";
+ SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbDriver, dbName));
+ SERVER_PROPERTIES.put("auth.db.driver", dbDriver);
SERVER_PROPERTIES.put("auth.db.username", TestSuite.VAL_PG_USER);
SERVER_PROPERTIES.put("auth.db.password", TestSuite.VAL_PG_PASS);
SERVER_PROPERTIES.put("auth.plainTextPassword", "false");
diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/KeyCloakTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/KeyCloakTests.java
index c062e4522..25305a337 100644
--- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/KeyCloakTests.java
+++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/KeyCloakTests.java
@@ -80,8 +80,9 @@ private static String resourceUrl(String path, String name) {
static {
final String dbName = "keycloakauth";
- SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbName));
- SERVER_PROPERTIES.put("auth.db.driver", "org.postgresql.Driver");
+ final String dbDriver = "org.postgresql.Driver";
+ SERVER_PROPERTIES.put("auth.db.url", TestSuite.createDbUrl(dbDriver, dbName));
+ SERVER_PROPERTIES.put("auth.db.driver", dbDriver);
SERVER_PROPERTIES.put("auth.db.username", TestSuite.VAL_PG_USER);
SERVER_PROPERTIES.put("auth.db.password", TestSuite.VAL_PG_PASS);
SERVER_PROPERTIES.put(KEY_DB_NAME, dbName);