diff --git a/CLAUDE.md b/CLAUDE.md index 14b06e7632..05837185c8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -101,7 +101,10 @@ cd package ### Testing Commands - **Run specific test class**: `mvn test -Dtest=ClassName` - **Run tests with specific pattern**: `mvn test -Dtest="*Pattern*"` +- **Run without slow/benchmark tests**: `mvn test -pl engine -DskipITs -Dgroups='!slow,!benchmark'` +- **Override fork count** (e.g. all cores): `mvn test -Dforkcount=1C` - **Performance tests**: Located in `src/test/java/performance/` packages +- **Parallel execution**: enabled by default - classes run concurrently across JVM forks; methods within a class run sequentially. Tests that mutate `GlobalConfiguration` are annotated `@ResourceLock("GlobalConfiguration")` to serialize with each other. ## Codebase Navigation Map diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f95f9770e5..661cf915e9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -115,6 +115,26 @@ Build and run default tests: $ mvn clean install ``` +Tests run in parallel by default: classes execute concurrently across multiple JVM forks (`forkCount=0.5C`, i.e. half the available CPU cores). No extra flags needed. + +Run only unit tests for the engine module, skipping slow/benchmark tests: + +```shell +$ mvn test -pl engine -DskipITs -Dgroups='!slow,!benchmark' +``` + +Override the number of parallel JVM forks (e.g. use all cores): + +```shell +$ mvn test -pl engine -DskipITs -Dforkcount=1C +``` + +Run a single test class: + +```shell +$ mvn test -pl engine -Dtest=MyTestClass -DskipITs +``` + To run additional integration test locally use: ```shell diff --git a/engine/src/main/java/com/arcadedb/GlobalConfiguration.java b/engine/src/main/java/com/arcadedb/GlobalConfiguration.java index e60570c9f4..8a8cffb18f 100644 --- a/engine/src/main/java/com/arcadedb/GlobalConfiguration.java +++ b/engine/src/main/java/com/arcadedb/GlobalConfiguration.java @@ -42,20 +42,19 @@ public enum GlobalConfiguration { // ENVIRONMENT DUMP_CONFIG_AT_STARTUP("arcadedb.dumpConfigAtStartup", SCOPE.JVM, "Dumps the configuration at startup", Boolean.class, false, value -> { - //dumpConfiguration(System.out); - - try { - final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - dumpConfiguration(new PrintStream(buffer)); - if (LogManager.instance() != null) - LogManager.instance().log(buffer, Level.WARNING, new String(buffer.toByteArray())); - else - System.out.println(new String(buffer.toByteArray())); + if (Boolean.TRUE.equals(value)) + try { + final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + dumpConfiguration(new PrintStream(buffer)); + if (LogManager.instance() != null) + LogManager.instance().log(buffer, Level.WARNING, new String(buffer.toByteArray())); + else + System.out.println(new String(buffer.toByteArray())); - buffer.close(); - } catch (IOException e) { - System.out.println("Error on printing initial configuration to log (error=" + e + ")"); - } + buffer.close(); + } catch (IOException e) { + System.out.println("Error on printing initial configuration to log (error=" + e + ")"); + } return value; }), diff --git a/engine/src/test/java/com/arcadedb/ACIDTransactionTest.java b/engine/src/test/java/com/arcadedb/ACIDTransactionTest.java index 31d773da9c..4d38ee62d3 100644 --- a/engine/src/test/java/com/arcadedb/ACIDTransactionTest.java +++ b/engine/src/test/java/com/arcadedb/ACIDTransactionTest.java @@ -48,8 +48,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; +import org.junit.jupiter.api.parallel.Isolated; +import org.junit.jupiter.api.parallel.ResourceLock; @Tag("slow") +@Isolated +@ResourceLock("GlobalConfiguration") class ACIDTransactionTest extends TestHelper { @Test void asyncTX() { diff --git a/engine/src/test/java/com/arcadedb/CompareParserAST.java b/engine/src/test/java/com/arcadedb/CompareParserAST.java index c5528036c4..2cabd7e9a9 100644 --- a/engine/src/test/java/com/arcadedb/CompareParserAST.java +++ b/engine/src/test/java/com/arcadedb/CompareParserAST.java @@ -7,10 +7,12 @@ import java.util.List; import java.util.Map; +import org.junit.jupiter.api.parallel.ResourceLock; /** * Compares the AST generated by ANTLR and JavaCC parsers for the same MATCH query. */ +@ResourceLock("GlobalConfiguration") public class CompareParserAST { public static void main(String[] args) { DatabaseFactory factory = new DatabaseFactory("./target/databases/compare-parser"); diff --git a/engine/src/test/java/com/arcadedb/GlobalConfigurationTest.java b/engine/src/test/java/com/arcadedb/GlobalConfigurationTest.java index 9543702020..c0ac5f9e19 100644 --- a/engine/src/test/java/com/arcadedb/GlobalConfigurationTest.java +++ b/engine/src/test/java/com/arcadedb/GlobalConfigurationTest.java @@ -22,7 +22,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import org.junit.jupiter.api.parallel.ResourceLock; +@ResourceLock("GlobalConfiguration") class GlobalConfigurationTest extends TestHelper { @Test void maxPageRAMAutoTune() { diff --git a/engine/src/test/java/com/arcadedb/RandomTestMultiThreadsTest.java b/engine/src/test/java/com/arcadedb/RandomTestMultiThreadsTest.java index 0cc8385b49..b22c1444d3 100644 --- a/engine/src/test/java/com/arcadedb/RandomTestMultiThreadsTest.java +++ b/engine/src/test/java/com/arcadedb/RandomTestMultiThreadsTest.java @@ -42,7 +42,9 @@ import java.util.logging.*; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; +@ResourceLock("GlobalConfiguration") class RandomTestMultiThreadsTest extends TestHelper { private static final int CYCLES = 10000; private static final int STARTING_ACCOUNT = 10000; diff --git a/engine/src/test/java/com/arcadedb/TestHelper.java b/engine/src/test/java/com/arcadedb/TestHelper.java index 7528aa83e3..36f0ccc2ff 100644 --- a/engine/src/test/java/com/arcadedb/TestHelper.java +++ b/engine/src/test/java/com/arcadedb/TestHelper.java @@ -34,6 +34,8 @@ import java.io.File; import java.util.Collection; +import java.util.EnumMap; +import java.util.Map; import java.util.Random; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; @@ -43,10 +45,13 @@ import static org.assertj.core.api.Assertions.fail; public abstract class TestHelper { - protected static final int PARALLEL_LEVEL = 4; + protected static final int PARALLEL_LEVEL = 4; protected final DatabaseFactory factory; protected Database database; - protected boolean autoStartTx = false; + protected boolean autoStartTx = false; + + private static final Object ACTIVE_DB_LOCK = new Object(); + private Map configSnapshot; public interface DatabaseTest { void call(PAR iArgument) throws Exception; @@ -158,6 +163,7 @@ protected void endTest() { @BeforeEach public void beforeTest() { + configSnapshot = captureConfigSnapshot(); GlobalConfiguration.SERVER_ROOT_PATH.setValue("./target"); if (autoStartTx && !database.isTransactionActive()) database.begin(); @@ -184,7 +190,7 @@ public void afterTest() { checkActiveDatabases(); FileUtils.deleteRecursively(new File(getDatabasePath())); - GlobalConfiguration.resetAll(); + restoreConfigSnapshot(configSnapshot); } @AfterAll @@ -192,6 +198,20 @@ public static void endAllTests() { GlobalConfiguration.resetAll(); } + private static Map captureConfigSnapshot() { + final Map snapshot = new EnumMap<>(GlobalConfiguration.class); + for (final GlobalConfiguration v : GlobalConfiguration.values()) + snapshot.put(v, v.getValue()); + return snapshot; + } + + private static void restoreConfigSnapshot(final Map snapshot) { + if (snapshot == null) + return; + for (final Map.Entry e : snapshot.entrySet()) + e.getKey().setValue(e.getValue()); + } + protected String getPerformanceProfile() { return "default"; } @@ -227,15 +247,17 @@ protected void checkDatabaseIntegrity() { } public static void checkActiveDatabases() { - final Collection activeDatabases = DatabaseFactory.getActiveDatabaseInstances(); + synchronized (ACTIVE_DB_LOCK) { + final Collection activeDatabases = DatabaseFactory.getActiveDatabaseInstances(); - if (!activeDatabases.isEmpty()) - LogManager.instance() - .log(TestHelper.class, Level.SEVERE, "Found active databases: " + activeDatabases + ". Forced closing..."); + if (!activeDatabases.isEmpty()) + LogManager.instance() + .log(TestHelper.class, Level.SEVERE, "Found active databases: " + activeDatabases + ". Forced closing..."); - for (final Database db : activeDatabases) - db.close(); + for (final Database db : activeDatabases) + db.close(); - assertThat(activeDatabases.isEmpty()).as("Found active databases: " + activeDatabases).isTrue(); + assertThat(activeDatabases.isEmpty()).as("Found active databases: " + activeDatabases).isTrue(); + } } } diff --git a/engine/src/test/java/com/arcadedb/engine/RecordRecyclingTest.java b/engine/src/test/java/com/arcadedb/engine/RecordRecyclingTest.java index dce23716be..2ddb7ef933 100644 --- a/engine/src/test/java/com/arcadedb/engine/RecordRecyclingTest.java +++ b/engine/src/test/java/com/arcadedb/engine/RecordRecyclingTest.java @@ -34,8 +34,10 @@ import static com.arcadedb.schema.LocalSchema.STATISTICS_FILE_NAME; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; @Tag("slow") +@ResourceLock("GlobalConfiguration") class RecordRecyclingTest { private final static int TOT_RECORDS = 100_000; private final static String VERTEX_TYPE = "Product"; diff --git a/engine/src/test/java/com/arcadedb/engine/TestInsertAndSelectWithThreadBucketSelectionStrategy.java b/engine/src/test/java/com/arcadedb/engine/TestInsertAndSelectWithThreadBucketSelectionStrategy.java index 89838d2e02..caef37188d 100644 --- a/engine/src/test/java/com/arcadedb/engine/TestInsertAndSelectWithThreadBucketSelectionStrategy.java +++ b/engine/src/test/java/com/arcadedb/engine/TestInsertAndSelectWithThreadBucketSelectionStrategy.java @@ -34,7 +34,9 @@ import java.time.format.DateTimeFormatter; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; +@ResourceLock("GlobalConfiguration") class TestInsertAndSelectWithThreadBucketSelectionStrategy { @BeforeEach diff --git a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConstructionFunctionsTest.java b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConstructionFunctionsTest.java index e1b72770d5..9c79ee5d08 100644 --- a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConstructionFunctionsTest.java +++ b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConstructionFunctionsTest.java @@ -39,7 +39,7 @@ class GeomFromText { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.geomFromText('POINT (10 20)') as geom"); assertThat(result.hasNext()).isTrue(); final Object geom = result.next().getProperty("geom"); @@ -58,7 +58,7 @@ void javaExecuteHappyPath() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.geomFromText(null) as geom"); assertThat(result.hasNext()).isTrue(); final Object geom = result.next().getProperty("geom"); @@ -100,7 +100,7 @@ class Point { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.point(10, 20) as wkt"); assertThat(result.hasNext()).isTrue(); final String wkt = result.next().getProperty("wkt"); @@ -124,7 +124,7 @@ void javaExecuteHappyPath() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.point(null, 20) as wkt"); assertThat(result.hasNext()).isTrue(); final Object wkt = result.next().getProperty("wkt"); @@ -164,7 +164,7 @@ class LineString { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.lineString([[0,0],[10,10],[20,0]]) as wkt"); assertThat(result.hasNext()).isTrue(); final String wkt = result.next().getProperty("wkt"); @@ -193,7 +193,7 @@ void javaExecuteHappyPath() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.lineString(null) as wkt"); assertThat(result.hasNext()).isTrue(); final Object wkt = result.next().getProperty("wkt"); @@ -239,7 +239,7 @@ class Polygon { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.polygon([[0,0],[10,0],[10,10],[0,10],[0,0]]) as wkt"); assertThat(result.hasNext()).isTrue(); final String wkt = result.next().getProperty("wkt"); @@ -265,7 +265,7 @@ void javaExecuteHappyPath() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.polygon(null) as wkt"); assertThat(result.hasNext()).isTrue(); final Object wkt = result.next().getProperty("wkt"); @@ -281,7 +281,7 @@ void nullInput_execute_returnsNull() { @Test void openRing_sql_autoClose() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.polygon([[0,0],[10,0],[10,10],[0,10]]) as wkt"); assertThat(result.hasNext()).isTrue(); final String wkt = result.next().getProperty("wkt"); diff --git a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConversionFunctionsTest.java b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConversionFunctionsTest.java index 132c637ff7..8367391f02 100644 --- a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConversionFunctionsTest.java +++ b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoConversionFunctionsTest.java @@ -37,7 +37,7 @@ class AsText { @Test void sqlStringInput_returnedAsIs() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.asText('POINT (10 20)') as wkt"); assertThat(result.hasNext()).isTrue(); assertThat(result.next().getProperty("wkt")).isEqualTo("POINT (10 20)"); @@ -46,7 +46,7 @@ void sqlStringInput_returnedAsIs() throws Exception { @Test void sqlShapeInput_returnsWkt() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.asText(geo.geomFromText('POINT (10 20)')) as wkt"); assertThat(result.hasNext()).isTrue(); @@ -77,7 +77,7 @@ void javaExecute_shapeInput_returnsWkt() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.asText(null) as wkt"); assertThat(result.hasNext()).isTrue(); final Object val = result.next().getProperty("wkt"); @@ -99,7 +99,7 @@ class AsGeoJson { @Test void sqlPoint_containsPointType() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.asGeoJson('POINT (10 20)') as json"); assertThat(result.hasNext()).isTrue(); final String json = result.next().getProperty("json"); @@ -113,7 +113,7 @@ void sqlPoint_containsPointType() throws Exception { @Test void sqlPolygon_containsPolygonType() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.asGeoJson('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as json"); assertThat(result.hasNext()).isTrue(); @@ -144,7 +144,7 @@ void javaExecute_lineString_containsLineStringType() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.asGeoJson(null) as json"); assertThat(result.hasNext()).isTrue(); final Object val = result.next().getProperty("json"); @@ -166,7 +166,7 @@ class X { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.x('POINT (10 20)') as x"); assertThat(result.hasNext()).isTrue(); final Double x = result.next().getProperty("x"); @@ -195,7 +195,7 @@ void javaExecute_shapeInput() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.x(null) as x"); assertThat(result.hasNext()).isTrue(); final Object val = result.next().getProperty("x"); @@ -211,7 +211,7 @@ void nullInput_execute_returnsNull() { @Test void polygonInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.x('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as x"); assertThat(result.hasNext()).isTrue(); @@ -252,7 +252,7 @@ class Y { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.y('POINT (10 20)') as y"); assertThat(result.hasNext()).isTrue(); final Double y = result.next().getProperty("y"); @@ -281,7 +281,7 @@ void javaExecute_shapeInput() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.y(null) as y"); assertThat(result.hasNext()).isTrue(); final Object val = result.next().getProperty("y"); @@ -297,7 +297,7 @@ void nullInput_execute_returnsNull() { @Test void polygonInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.y('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as y"); assertThat(result.hasNext()).isTrue(); diff --git a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoHashIndexTest.java b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoHashIndexTest.java index 2e35f27195..194299c375 100644 --- a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoHashIndexTest.java +++ b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoHashIndexTest.java @@ -38,7 +38,7 @@ class GeoHashIndexTest { void geoManualIndexPoints() throws Exception { final int TOTAL = 1_000; - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { db.transaction(() -> { final DocumentType type = db.getSchema().createDocumentType("Restaurant"); @@ -74,7 +74,7 @@ void geoManualIndexPoints() throws Exception { void geoManualIndexBoundingBoxes() throws Exception { final int TOTAL = 1_000; - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { db.transaction(() -> { final DocumentType type = db.getSchema().createDocumentType("Restaurant"); diff --git a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoMeasurementFunctionsTest.java b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoMeasurementFunctionsTest.java index 02b9581e6f..bdc206c37d 100644 --- a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoMeasurementFunctionsTest.java +++ b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoMeasurementFunctionsTest.java @@ -36,7 +36,7 @@ class Buffer { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.buffer('POINT (10 20)', 1.0) as wkt"); assertThat(result.hasNext()).isTrue(); final String wkt = result.next().getProperty("wkt"); @@ -55,7 +55,7 @@ void javaExecuteHappyPath() { @Test void nullGeometry_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.buffer(null, 1.0) as wkt"); assertThat(result.hasNext()).isTrue(); final String wkt = result.next().getProperty("wkt"); @@ -84,7 +84,7 @@ void invalidGeometry_execute_throwsException() { @Test void optionsMap_squareCap() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.buffer('POINT (10 20)', 1.0, { endCapStyle: 'SQUARE', quadrantSegments: 4 }) as wkt"); assertThat(result.hasNext()).isTrue(); @@ -110,7 +110,7 @@ class Distance { @Test void sqlHappyPath_meters() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.distance('POINT (0 0)', 'POINT (1 0)') as dist"); assertThat(result.hasNext()).isTrue(); final Double dist = result.next().getProperty("dist"); @@ -121,7 +121,7 @@ void sqlHappyPath_meters() throws Exception { @Test void sqlHappyPath_km_lessThanMeters() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet rMeters = db.query("sql", "select geo.distance('POINT (0 0)', 'POINT (1 0)') as dist"); final Double distM = rMeters.next().getProperty("dist"); final ResultSet rKm = db.query("sql", "select geo.distance('POINT (0 0)', 'POINT (1 0)', 'km') as dist"); @@ -150,7 +150,7 @@ void javaExecuteHappyPath_miles() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.distance(null, 'POINT (1 0)') as dist"); assertThat(result.hasNext()).isTrue(); final Double dist = result.next().getProperty("dist"); @@ -195,7 +195,7 @@ class Area { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.area('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as area"); assertThat(result.hasNext()).isTrue(); @@ -215,7 +215,7 @@ void javaExecuteHappyPath() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.area(null) as area"); assertThat(result.hasNext()).isTrue(); final Double area = result.next().getProperty("area"); @@ -246,7 +246,7 @@ class Envelope { @Test void sqlHappyPath() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.envelope('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as wkt"); assertThat(result.hasNext()).isTrue(); @@ -268,7 +268,7 @@ void javaExecuteHappyPath() { @Test void nullInput_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet result = db.query("sql", "select geo.envelope(null) as wkt"); assertThat(result.hasNext()).isTrue(); final String wkt = result.next().getProperty("wkt"); diff --git a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoPredicateFunctionsTest.java b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoPredicateFunctionsTest.java index 9049e08fe0..fe1a447369 100644 --- a/engine/src/test/java/com/arcadedb/function/sql/geo/GeoPredicateFunctionsTest.java +++ b/engine/src/test/java/com/arcadedb/function/sql/geo/GeoPredicateFunctionsTest.java @@ -39,7 +39,7 @@ class Within { @Test void sql_pointInsidePolygon_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.within('POINT (5 5)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -48,7 +48,7 @@ void sql_pointInsidePolygon_returnsTrue() throws Exception { @Test void sql_pointOutsidePolygon_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.within('POINT (15 15)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -69,7 +69,7 @@ void javaExecute_pointOutside_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.within(null, 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); final Object val = r.next().getProperty("v"); @@ -97,7 +97,7 @@ class Intersects { @Test void sql_overlappingPolygons_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.intersects('POLYGON ((0 0, 6 0, 6 6, 0 6, 0 0))', 'POLYGON ((3 3, 9 3, 9 9, 3 9, 3 3))') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -106,7 +106,7 @@ void sql_overlappingPolygons_returnsTrue() throws Exception { @Test void sql_disjointPolygons_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.intersects('POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))', 'POLYGON ((5 5, 9 5, 9 9, 5 9, 5 5))') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -131,7 +131,7 @@ void javaExecute_disjoint_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.intersects(null, 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); final Object val = r.next().getProperty("v"); @@ -153,7 +153,7 @@ class Contains { @Test void sql_polygonContainsPoint_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.contains('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))', 'POINT (5 5)') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -162,7 +162,7 @@ void sql_polygonContainsPoint_returnsTrue() throws Exception { @Test void sql_polygonDoesNotContainOutsidePoint_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.contains('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))', 'POINT (15 15)') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -183,7 +183,7 @@ void javaExecute_doesNotContain_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.contains(null, 'POINT (5 5)') as v"); final Object val = r.next().getProperty("v"); @@ -205,7 +205,7 @@ class DWithin { @Test void sql_nearbyPoints_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.dWithin('POINT (0 0)', 'POINT (1 1)', 2.0) as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -214,7 +214,7 @@ void sql_nearbyPoints_returnsTrue() throws Exception { @Test void sql_farPoints_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.dWithin('POINT (0 0)', 'POINT (10 10)', 1.0) as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -235,7 +235,7 @@ void javaExecute_farAway_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.dWithin(null, 'POINT (1 1)', 2.0) as v"); final Object val = r.next().getProperty("v"); @@ -270,7 +270,7 @@ class Disjoint { @Test void sql_farApartShapes_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.disjoint('POINT (50 50)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -279,7 +279,7 @@ void sql_farApartShapes_returnsTrue() throws Exception { @Test void sql_intersectingShapes_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.disjoint('POINT (5 5)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -300,7 +300,7 @@ void javaExecute_intersecting_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.disjoint(null, 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); final Object val = r.next().getProperty("v"); @@ -322,7 +322,7 @@ class Equals { @Test void sql_identicalPoints_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.equals('POINT (5 5)', 'POINT (5 5)') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -331,7 +331,7 @@ void sql_identicalPoints_returnsTrue() throws Exception { @Test void sql_differentPoints_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.equals('POINT (5 5)', 'POINT (6 6)') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -352,7 +352,7 @@ void javaExecute_differentPoints_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.equals(null, 'POINT (5 5)') as v"); final Object val = r.next().getProperty("v"); @@ -374,7 +374,7 @@ class Crosses { @Test void sql_lineCrossesPolygon_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.crosses('LINESTRING (-1 5, 11 5)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -383,7 +383,7 @@ void sql_lineCrossesPolygon_returnsTrue() throws Exception { @Test void sql_disjointLine_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.crosses('LINESTRING (20 20, 30 30)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -408,7 +408,7 @@ void javaExecute_overlappingPolygons_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.crosses(null, 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); final Object val = r.next().getProperty("v"); @@ -430,7 +430,7 @@ class Overlaps { @Test void sql_partiallyOverlapping_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.overlaps('POLYGON ((0 0, 6 0, 6 6, 0 6, 0 0))', 'POLYGON ((3 3, 9 3, 9 9, 3 9, 3 3))') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -439,7 +439,7 @@ void sql_partiallyOverlapping_returnsTrue() throws Exception { @Test void sql_disjointPolygons_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.overlaps('POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))', 'POLYGON ((5 5, 9 5, 9 9, 5 9, 5 5))') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -464,7 +464,7 @@ void javaExecute_disjoint_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.overlaps(null, 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); final Object val = r.next().getProperty("v"); @@ -486,7 +486,7 @@ class Touches { @Test void sql_adjacentPolygons_returnsTrue() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.touches('POLYGON ((0 0, 5 0, 5 5, 0 5, 0 0))', 'POLYGON ((5 0, 10 0, 10 5, 5 5, 5 0))') as v"); assertThat((Boolean) r.next().getProperty("v")).isTrue(); @@ -495,7 +495,7 @@ void sql_adjacentPolygons_returnsTrue() throws Exception { @Test void sql_disjointPolygons_returnsFalse() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.touches('POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))', 'POLYGON ((5 5, 9 5, 9 9, 5 9, 5 5))') as v"); assertThat((Boolean) r.next().getProperty("v")).isFalse(); @@ -520,7 +520,7 @@ void javaExecute_disjoint_returnsFalse() { @Test void nullFirstArg_sql_returnsNull() throws Exception { - TestHelper.executeInNewDatabase("GeoDatabase", (db) -> { + TestHelper.executeInNewDatabase((db) -> { final ResultSet r = db.query("sql", "select geo.touches(null, 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v"); final Object val = r.next().getProperty("v"); diff --git a/engine/src/test/java/com/arcadedb/function/sql/misc/SQLFunctionConvertTest.java b/engine/src/test/java/com/arcadedb/function/sql/misc/SQLFunctionConvertTest.java index 23772ef9eb..3f6ef169f2 100644 --- a/engine/src/test/java/com/arcadedb/function/sql/misc/SQLFunctionConvertTest.java +++ b/engine/src/test/java/com/arcadedb/function/sql/misc/SQLFunctionConvertTest.java @@ -32,10 +32,12 @@ import java.util.List; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; /** * @author Luca Garulli (l.garulli--(at)--arcadedata.com) */ +@ResourceLock("GlobalConfiguration") public class SQLFunctionConvertTest { public SQLFunctionConvertTest() { GlobalConfiguration.resetAll(); diff --git a/engine/src/test/java/com/arcadedb/graph/BaseGraphTest.java b/engine/src/test/java/com/arcadedb/graph/BaseGraphTest.java index 4a7a13f187..dca2ef8c0e 100644 --- a/engine/src/test/java/com/arcadedb/graph/BaseGraphTest.java +++ b/engine/src/test/java/com/arcadedb/graph/BaseGraphTest.java @@ -18,15 +18,9 @@ */ package com.arcadedb.graph; -import com.arcadedb.GlobalConfiguration; import com.arcadedb.TestHelper; import com.arcadedb.database.Database; import com.arcadedb.database.RID; -import com.arcadedb.utility.FileUtils; -import org.assertj.core.api.Assertions; - - -import java.io.*; import java.util.*; import static org.assertj.core.api.Assertions.assertThat; @@ -38,15 +32,10 @@ public abstract class BaseGraphTest extends TestHelper { protected static final String EDGE1_TYPE_NAME = "E1"; protected static final String EDGE2_TYPE_NAME = "E2"; protected static final String EDGE3_TYPE_NAME = "E3"; - protected static final String DB_PATH = "target/databases/graph"; - protected static RID root; @Override public void beginTest() { - GlobalConfiguration.resetAll(); - FileUtils.deleteRecursively(new File(DB_PATH)); - database.transaction(() -> { assertThat(database.getSchema().existsType(VERTEX1_TYPE_NAME)).isFalse(); database.getSchema().buildVertexType().withName(VERTEX1_TYPE_NAME).withTotalBuckets(3).create(); diff --git a/engine/src/test/java/com/arcadedb/graph/TxGraphTest.java b/engine/src/test/java/com/arcadedb/graph/TxGraphTest.java index bba0fc21b1..a95dda7920 100644 --- a/engine/src/test/java/com/arcadedb/graph/TxGraphTest.java +++ b/engine/src/test/java/com/arcadedb/graph/TxGraphTest.java @@ -27,8 +27,6 @@ import static org.assertj.core.api.Assertions.assertThat; class TxGraphTest extends TestHelper { - protected static final String DB_PATH = "target/databases/graph"; - @Test void edgeChunkIsLoadedFromCurrentTx() { database.setReadYourWrites(false); diff --git a/engine/src/test/java/com/arcadedb/index/ConcurrentCompactionTest.java b/engine/src/test/java/com/arcadedb/index/ConcurrentCompactionTest.java index 4a69b673ff..b85085fd7b 100644 --- a/engine/src/test/java/com/arcadedb/index/ConcurrentCompactionTest.java +++ b/engine/src/test/java/com/arcadedb/index/ConcurrentCompactionTest.java @@ -28,12 +28,14 @@ import java.util.concurrent.atomic.*; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; /** * Regression test for #3615: concurrent index compaction causes IndexOutOfBoundsException * because LocalSchema.files (ArrayList) was accessed without synchronization from multiple * async compaction threads calling registerFile()/removeFile() simultaneously. */ +@ResourceLock("GlobalConfiguration") class ConcurrentCompactionTest extends TestHelper { private static final int TYPES_COUNT = 8; private static final int RECORDS_PER_TYPE = 5_000; diff --git a/engine/src/test/java/com/arcadedb/index/Issue2702SequentialIndexCreationTest.java b/engine/src/test/java/com/arcadedb/index/Issue2702SequentialIndexCreationTest.java index f7dbc4019c..b8a983fcb4 100644 --- a/engine/src/test/java/com/arcadedb/index/Issue2702SequentialIndexCreationTest.java +++ b/engine/src/test/java/com/arcadedb/index/Issue2702SequentialIndexCreationTest.java @@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; /** * Tests sequential index creation on large datasets to ensure it doesn't fail with NeedRetryException @@ -48,6 +49,7 @@ * * @author ArcadeDB Team */ +@ResourceLock("GlobalConfiguration") class Issue2702SequentialIndexCreationTest extends TestHelper { private static final int TOT = 100_000; // Large enough to trigger compaction private static final int INDEX_PAGE_SIZE = 64 * 1024; diff --git a/engine/src/test/java/com/arcadedb/index/Issue3714BatchUpsertArrayCopyTest.java b/engine/src/test/java/com/arcadedb/index/Issue3714BatchUpsertArrayCopyTest.java index 0cde8c7e27..1267545f66 100644 --- a/engine/src/test/java/com/arcadedb/index/Issue3714BatchUpsertArrayCopyTest.java +++ b/engine/src/test/java/com/arcadedb/index/Issue3714BatchUpsertArrayCopyTest.java @@ -32,6 +32,7 @@ import java.util.concurrent.atomic.*; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; /** * Regression test for #3714: "arraycopy: length is negative" error during batch @@ -41,6 +42,7 @@ * * @author Luca Garulli (l.garulli@arcadedata.com) */ +@ResourceLock("GlobalConfiguration") class Issue3714BatchUpsertArrayCopyTest { private static final String DB_PATH = "target/databases/Issue3714BatchUpsertArrayCopyTest"; diff --git a/engine/src/test/java/com/arcadedb/index/LSMTreeIndexCompactionTest.java b/engine/src/test/java/com/arcadedb/index/LSMTreeIndexCompactionTest.java index 3fa7b9ae8c..31c48e2795 100644 --- a/engine/src/test/java/com/arcadedb/index/LSMTreeIndexCompactionTest.java +++ b/engine/src/test/java/com/arcadedb/index/LSMTreeIndexCompactionTest.java @@ -38,12 +38,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; +import org.junit.jupiter.api.parallel.ResourceLock; /** * This test stresses the index compaction by forcing using only 1MB of RAM for compaction causing multiple page compacted index. * * @author Luca */ +@ResourceLock("GlobalConfiguration") class LSMTreeIndexCompactionTest extends TestHelper { private static final int TOT = 50_000; private static final int INDEX_PAGE_SIZE = 64 * 1024; // 64K diff --git a/engine/src/test/java/com/arcadedb/index/TypeLSMTreeIndexTest.java b/engine/src/test/java/com/arcadedb/index/TypeLSMTreeIndexTest.java index 82c5fcf2cd..4863b25653 100644 --- a/engine/src/test/java/com/arcadedb/index/TypeLSMTreeIndexTest.java +++ b/engine/src/test/java/com/arcadedb/index/TypeLSMTreeIndexTest.java @@ -42,8 +42,10 @@ import java.util.logging.Level; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; @Tag("slow") +@ResourceLock("GlobalConfiguration") class TypeLSMTreeIndexTest extends TestHelper { private static final int TOT = 100000; private static final String TYPE_NAME = "V"; diff --git a/engine/src/test/java/com/arcadedb/index/vector/PQSearchDebugTest.java b/engine/src/test/java/com/arcadedb/index/vector/PQSearchDebugTest.java index 5d247a093c..5eaa46b616 100644 --- a/engine/src/test/java/com/arcadedb/index/vector/PQSearchDebugTest.java +++ b/engine/src/test/java/com/arcadedb/index/vector/PQSearchDebugTest.java @@ -32,6 +32,7 @@ import java.util.Random; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; /** * Regression test for PRODUCT quantization search returning too few results after database reopen. @@ -41,6 +42,7 @@ * * @author Luca Garulli (l.garulli@arcadedata.com) */ +@ResourceLock("GlobalConfiguration") class PQSearchDebugTest { private static final String DB_PATH = "target/test-databases/PQSearchDebugTest"; private static final int NUM_VECTORS = 10_000; diff --git a/engine/src/test/java/com/arcadedb/query/polyglot/PolyglotQueryTest.java b/engine/src/test/java/com/arcadedb/query/polyglot/PolyglotQueryTest.java index ff006745a3..71f03a2838 100644 --- a/engine/src/test/java/com/arcadedb/query/polyglot/PolyglotQueryTest.java +++ b/engine/src/test/java/com/arcadedb/query/polyglot/PolyglotQueryTest.java @@ -35,7 +35,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; +import org.junit.jupiter.api.parallel.ResourceLock; +@ResourceLock("GlobalConfiguration") class PolyglotQueryTest extends TestHelper { @Test void sum() { diff --git a/engine/src/test/java/com/arcadedb/query/sql/OrderByTest.java b/engine/src/test/java/com/arcadedb/query/sql/OrderByTest.java index 6f8ffd7096..70ec8841a9 100644 --- a/engine/src/test/java/com/arcadedb/query/sql/OrderByTest.java +++ b/engine/src/test/java/com/arcadedb/query/sql/OrderByTest.java @@ -36,10 +36,12 @@ import java.time.format.*; import static org.assertj.core.api.Assertions.*; +import org.junit.jupiter.api.parallel.ResourceLock; /** * From Issue https://github.com/ArcadeData/arcadedb/issues/839 */ +@ResourceLock("GlobalConfiguration") class OrderByTest { @BeforeEach diff --git a/engine/src/test/java/com/arcadedb/query/sql/executor/SelectStatementExecutionTest.java b/engine/src/test/java/com/arcadedb/query/sql/executor/SelectStatementExecutionTest.java index 616a29eca7..7bf750393a 100644 --- a/engine/src/test/java/com/arcadedb/query/sql/executor/SelectStatementExecutionTest.java +++ b/engine/src/test/java/com/arcadedb/query/sql/executor/SelectStatementExecutionTest.java @@ -54,7 +54,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.fail; +import org.junit.jupiter.api.parallel.ResourceLock; +@ResourceLock("GlobalConfiguration") public class SelectStatementExecutionTest extends TestHelper { @Test diff --git a/engine/src/test/java/com/arcadedb/query/sql/executor/UpdateStatementExecutionTest.java b/engine/src/test/java/com/arcadedb/query/sql/executor/UpdateStatementExecutionTest.java old mode 100755 new mode 100644 index 154a995e30..5a781d64ce --- a/engine/src/test/java/com/arcadedb/query/sql/executor/UpdateStatementExecutionTest.java +++ b/engine/src/test/java/com/arcadedb/query/sql/executor/UpdateStatementExecutionTest.java @@ -41,10 +41,12 @@ import java.util.*; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; /** * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +@ResourceLock("GlobalConfiguration") public class UpdateStatementExecutionTest extends TestHelper { private String className; diff --git a/engine/src/test/java/com/arcadedb/query/sql/executor/UpsertStatementExecutionTest.java b/engine/src/test/java/com/arcadedb/query/sql/executor/UpsertStatementExecutionTest.java old mode 100755 new mode 100644 index c1d1d9d35f..3c3bd60763 --- a/engine/src/test/java/com/arcadedb/query/sql/executor/UpsertStatementExecutionTest.java +++ b/engine/src/test/java/com/arcadedb/query/sql/executor/UpsertStatementExecutionTest.java @@ -38,11 +38,13 @@ import java.util.*; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.parallel.ResourceLock; /** * @author Luca Garulli (l.garulli@arcadedata.com) * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) */ +@ResourceLock("GlobalConfiguration") public class UpsertStatementExecutionTest extends TestHelper { private String className; diff --git a/engine/src/test/resources/junit-platform.properties b/engine/src/test/resources/junit-platform.properties index 7cea63f8e3..01dc58f9bd 100644 --- a/engine/src/test/resources/junit-platform.properties +++ b/engine/src/test/resources/junit-platform.properties @@ -3,3 +3,10 @@ cucumber.execution.dry-run=false # Prevent Cucumber from auto-discovering features during normal test runs. # TCK features are only executed via OpenCypherTCKRunner suite class. cucumber.junit-platform.discovery.as-root-engine=false + +# Parallel test execution: classes run concurrently, methods within a class run sequentially +junit.jupiter.execution.parallel.enabled=true +junit.jupiter.execution.parallel.mode.default=same_thread +junit.jupiter.execution.parallel.mode.classes.default=concurrent +junit.jupiter.execution.parallel.config.strategy=dynamic +junit.jupiter.execution.parallel.config.dynamic.factor=1.0 diff --git a/pom.xml b/pom.xml index 56bfa1fcf7..fd5e14aea7 100644 --- a/pom.xml +++ b/pom.xml @@ -214,7 +214,8 @@ 60 - 1 + 0.5C + true false