You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by zs...@apache.org on 2026/09/30 11:02:28 UTC
(ignite) branch master updated: IGNITE-29064 Change calcite module dependency for junit framework from 4 to 5 (#13602)
This is an automated email from the ASF dual-hosted git repository.
zstan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 9c307612176 IGNITE-29064 Change calcite module dependency for junit framework from 4 to 5 (#13602)
9c307612176 is described below
commit 9c307612176af868de225c00b476a8b4e7988b9a
Author: Evgeniy Stanilovskiy <st...@gmail.com>
AuthorDate: Wed Sep 30 14:02:19 2026 +0300
IGNITE-29064 Change calcite module dependency for junit framework from 4 to 5 (#13602)
---
modules/calcite/pom.xml | 86 +++
.../cache/QueryEntityValueColumnAliasTest.java | 6 +-
.../cache/SessionContextSqlFunctionTest.java | 33 +-
.../CalciteQueryProcessorPropertiesTest.java | 3 +-
.../query/calcite/CalciteQueryProcessorTest.java | 21 +-
.../processors/query/calcite/CancelTest.java | 18 +-
.../calcite/GridCommonAbstractWrapperTest.java | 73 +++
.../processors/query/calcite/QueryChecker.java | 63 +-
.../processors/query/calcite/QueryCheckerTest.java | 6 +-
.../query/calcite/SqlFieldsQueryUsageTest.java | 15 +-
.../calcite/exec/ClosableIteratorsHolderTest.java | 15 +-
.../query/calcite/exec/KeyFilteringCursorTest.java | 5 +-
.../calcite/exec/LogicalRelImplementorTest.java | 13 +-
.../calcite/exec/NumericTypesPrecisionsTest.java | 6 +-
.../query/calcite/exec/RuntimeSortedIndexTest.java | 6 +-
.../calcite/exec/exp/IgniteSqlFunctionsTest.java | 57 +-
.../rel/AbstractExecutionParametrizedTest.java} | 15 +-
.../calcite/exec/rel/AbstractExecutionTest.java | 45 +-
.../exec/rel/AbstractSetOpExecutionTest.java | 12 +-
.../query/calcite/exec/rel/BaseAggregateTest.java | 71 +--
.../calcite/exec/rel/ContinuousExecutionTest.java | 32 +-
.../query/calcite/exec/rel/ExecutionTest.java | 51 +-
.../exec/rel/HashAggregateExecutionTest.java | 11 +-
.../rel/HashAggregateSingleGroupExecutionTest.java | 14 +-
.../exec/rel/HashIndexSpoolExecutionTest.java | 13 +-
.../calcite/exec/rel/HashJoinExecutionTest.java | 5 +-
.../calcite/exec/rel/JoinBuffersExecutionTest.java | 4 +-
.../query/calcite/exec/rel/LimitExecutionTest.java | 4 +-
.../calcite/exec/rel/MergeJoinExecutionTest.java | 12 +-
.../exec/rel/NestedLoopJoinExecutionTest.java | 17 +-
.../exec/rel/ScanTableRowExecutionTest.java | 4 +-
.../exec/rel/SortAggregateExecutionTest.java | 2 +-
.../exec/rel/SortedIndexSpoolExecutionTest.java | 13 +-
.../calcite/exec/rel/TableSpoolExecutionTest.java | 13 +-
.../exec/rel/TimeCalculationExecutionTest.java | 4 +-
.../calcite/exec/rel/UncollectExecutionTest.java | 4 +-
.../calcite/exec/rel/WindowExecutionTest.java | 11 +-
.../exec/task/QueryBlockingTaskExecutorTest.java | 6 +-
.../calcite/exec/task/QueryTasksQueueTest.java | 6 +-
.../calcite/exec/tracker/MemoryTrackerTest.java | 6 +-
.../integration/AbstractBasicIntegrationTest.java | 26 +-
.../AbstractBasicIntegrationTransactionalTest.java | 27 +-
.../integration/AbstractDdlIntegrationTest.java | 8 +-
.../AbstractMultiEngineIntegrationTest.java | 22 +-
.../integration/AggregatesIntegrationTest.java | 6 +-
.../integration/AuthorizationIntegrationTest.java | 37 +-
.../BulkOperationDeadlockIntegrationTest.java | 12 +-
.../query/calcite/integration/CacheStoreTest.java | 78 ++-
.../CacheWithInterceptorIntegrationTest.java | 25 +-
.../CalciteBasicSecondaryIndexIntegrationTest.java | 20 +-
.../CalciteErrorHandlilngIntegrationTest.java | 17 +-
.../integration/CalcitePlanningDumpTest.java | 21 +-
.../integration/CollectIntegrationTest.java | 2 +-
.../integration/CorrelatesIntegrationTest.java | 2 +-
.../query/calcite/integration/DataTypesTest.java | 10 +-
.../query/calcite/integration/DateTimeTest.java | 3 +-
.../DistributedJoinIntegrationTest.java | 2 +-
.../DynamicParametersIntegrationTest.java | 4 +-
.../integration/ExpiredEntriesIntegrationTest.java | 5 +-
.../query/calcite/integration/FunctionsTest.java | 2 +-
.../integration/HashSpoolIntegrationTest.java | 2 +-
.../integration/IndexDdlIntegrationTest.java | 4 +-
.../IndexMultiRangeScanIntegrationTest.java | 35 +-
.../integration/IndexRebuildIntegrationTest.java | 6 +-
.../IndexScanMultiNodeIntegrationTest.java | 2 +-
.../integration/IndexScanlIntegrationTest.java | 2 +-
.../integration/IndexSpoolIntegrationTest.java | 35 +-
.../query/calcite/integration/IntervalTest.java | 2 +-
.../calcite/integration/JoinIntegrationTest.java | 30 +-
.../integration/KeepBinaryIntegrationTest.java | 2 +-
.../integration/KeyClassChangeIntegrationTest.java | 12 +-
.../integration/KillCommandDdlIntegrationTest.java | 4 +-
.../KillQueryCommandDdlIntegrationTest.java | 22 +-
.../integration/LimitOffsetIntegrationTest.java | 2 +-
.../integration/LocalDateTimeSupportTest.java | 88 +--
.../integration/LocalQueryIntegrationTest.java | 4 +-
.../integration/MemoryQuotasIntegrationTest.java | 10 +-
.../integration/MetadataIntegrationTest.java | 3 +-
.../integration/MultiDcQueryMappingTest.java | 4 +-
.../OperatorsExtensionIntegrationTest.java | 2 +-
.../calcite/integration/PartitionPruneTest.java | 5 +-
.../PartitionsReservationIntegrationTest.java | 10 +-
.../QueryBlockingTaskExecutorIntegrationTest.java | 7 +-
.../QueryEngineConfigurationIntegrationTest.java | 6 +-
.../integration/QueryMetadataIntegrationTest.java | 3 +-
.../QueryWithPartitionsIntegrationTest.java | 25 +-
.../integration/RecursiveCteIntegrationTest.java | 2 +-
.../integration/ResultSetSizeMetricsTest.java | 2 +-
.../integration/RunningQueriesIntegrationTest.java | 22 +-
.../integration/ScalarInIntegrationTest.java | 4 +-
.../calcite/integration/SelectByKeyFieldTest.java | 8 +-
.../SelectForUpdateIntegrationTest.java | 8 +-
.../ServerStatisticsIntegrationTest.java | 2 +-
.../calcite/integration/SetOpIntegrationTest.java | 2 +-
.../integration/SortAggregateIntegrationTest.java | 2 +-
.../integration/SqlDiagnosticIntegrationTest.java | 19 +-
.../integration/SqlPlanHistoryIntegrationTest.java | 74 ++-
.../StatisticsCommandDdlIntegrationTest.java | 5 +-
.../calcite/integration/StdSqlOperatorsTest.java | 4 +-
.../calcite/integration/SystemColumnsScanTest.java | 4 +-
.../integration/SystemViewsIntegrationTest.java | 3 +-
.../integration/TableDdlIntegrationTest.java | 5 +-
.../integration/TableDmlIntegrationTest.java | 2 +-
.../integration/TestSuiteDeclarationArchTest.java | 127 ++++
.../integration/TimeoutIntegrationTest.java | 3 +-
.../calcite/integration/UnnestIntegrationTest.java | 2 +-
.../UnstableTopologyIntegrationTest.java | 32 +-
.../integration/UserDdlIntegrationTest.java | 2 +-
.../UserDefinedFunctionsIntegrationTest.java | 7 +-
...finedFunctionsIntegrationTransactionalTest.java | 2 +-
...UserDefinedTxAwareFunctionsIntegrationTest.java | 10 +-
.../calcite/integration/ViewsIntegrationTest.java | 19 +-
.../calcite/integration/WindowIntegrationTest.java | 2 +-
.../calcite/integration/tpch/AbstractTpchTest.java | 23 +-
.../calcite/integration/tpch/TpchScale001Test.java | 4 -
.../calcite/integration/tpch/TpchScale010Test.java | 4 -
.../query/calcite/jdbc/AbstractJdbcTest.java | 4 +-
.../jdbc/JdbcConnectionEnabledPropertyTest.java | 18 +-
.../query/calcite/jdbc/JdbcCrossEngineTest.java | 6 +-
.../query/calcite/jdbc/JdbcLocalFlagTest.java | 4 +-
.../query/calcite/jdbc/JdbcQueryTest.java | 19 +-
.../JdbcSetClientInfoCacheInterceptorTest.java | 35 +-
.../query/calcite/jdbc/JdbcSetClientInfoTest.java | 47 +-
.../jdbc/JdbcThinConnectionSavepointTest.java | 34 +-
.../jdbc/JdbcThinTransactionalSelfTest.java | 38 +-
.../query/calcite/logical/ScriptTestRunner.java | 271 --------
...lciteMessageUnmarshalThreadIntegrationTest.java | 2 +-
.../query/calcite/planner/AbstractPlannerTest.java | 13 +-
.../planner/AbstractPlannerUtilityTest.java | 3 +-
.../planner/AggregateDistinctPlannerTest.java | 23 +-
.../calcite/planner/AggregatePlannerTest.java | 29 +-
.../CorrelatedNestedLoopJoinPlannerTest.java | 4 +-
.../planner/CorrelatedSubqueryPlannerTest.java | 2 +-
.../calcite/planner/DataTypesPlannerTest.java | 2 +-
.../planner/DynamicParametersPlannerTest.java | 2 +-
.../calcite/planner/HashAggregatePlannerTest.java | 12 +-
.../calcite/planner/HashIndexSpoolPlannerTest.java | 2 +-
.../query/calcite/planner/HashJoinPlannerTest.java | 2 +-
.../calcite/planner/IndexRebuildPlannerTest.java | 5 +-
.../planner/IndexSearchBoundsPlannerTest.java | 4 +-
.../planner/InlineIndexScanPlannerTest.java | 2 +-
.../calcite/planner/JoinColocationPlannerTest.java | 4 +-
.../calcite/planner/JoinCommutePlannerTest.java | 4 +-
.../calcite/planner/JoinWithUsingPlannerTest.java | 6 +-
.../calcite/planner/LimitOffsetPlannerTest.java | 2 +-
.../calcite/planner/MergeJoinPlannerTest.java | 3 +-
.../query/calcite/planner/PlanExecutionTest.java | 12 +-
.../query/calcite/planner/PlanSplitterTest.java | 3 +-
.../query/calcite/planner/PlannerTimeoutTest.java | 14 +-
.../planner/ProjectFilterScanMergePlannerTest.java | 6 +-
.../calcite/planner/RecursiveCtePlannerTest.java | 2 +-
.../planner/RexSimplificationPlannerTest.java | 3 +-
.../calcite/planner/SerializationPlannerTest.java | 3 +-
.../query/calcite/planner/SetOpPlannerTest.java | 24 +-
.../calcite/planner/SortAggregatePlannerTest.java | 3 +-
.../planner/SortedIndexSpoolPlannerTest.java | 6 +-
.../calcite/planner/StatisticsPlannerTest.java | 6 +-
.../query/calcite/planner/TableDmlPlannerTest.java | 4 +-
.../calcite/planner/TableFunctionPlannerTest.java | 6 +-
.../calcite/planner/TableSpoolPlannerTest.java | 2 +-
.../calcite/planner/UncollectPlannerTest.java | 6 +-
.../query/calcite/planner/UnionPlannerTest.java | 3 +-
.../planner/UserDefinedViewsPlannerTest.java | 2 +-
.../query/calcite/planner/WindowPlannerTest.java | 2 +-
.../planner/hints/CommonHintsPlannerTest.java | 6 +-
.../planner/hints/ForceIndexHintPlannerTest.java | 6 +-
.../calcite/planner/hints/HintsTestSuite.java | 8 +-
.../planner/hints/JoinOrderHintsPlannerTest.java | 6 +-
.../planner/hints/JoinTypeHintPlannerTest.java | 7 +-
.../planner/hints/NoIndexHintPlannerTest.java | 6 +-
.../calcite/planner/tpc/TpchQueryPlannerTest.java | 23 +-
.../query/calcite/rules/JoinCommuteRulesTest.java | 8 +-
.../calcite/rules/JoinOrderOptimizationTest.java | 24 +-
.../query/calcite/rules/OrToUnionRuleTest.java | 8 +-
.../calcite/rules/ProjectScanMergeRuleTest.java | 8 +-
.../calcite/sql/ParserCodegenResourcesTest.java | 5 +-
.../query/calcite/sql/SqlCustomParserTest.java | 9 +-
.../query/calcite/sql/SqlReservedWordsTest.java | 6 +-
.../calcite/sql/SqlSelectForUpdateParserTest.java | 2 +-
.../query/calcite/thin/MultiLineQueryTest.java | 32 +-
.../query/calcite/type/OtherTypeTest.java | 2 +-
.../query/calcite/util/TypeUtilsTest.java | 2 +-
.../tx/AbstractQueryTransactionIsolationTest.java | 707 +++++++++++++++++++++
.../tx/SqlTransactionsIsolationTest.java | 85 +--
.../tx/SqlTransactionsSavepointTest.java | 31 +-
.../tx/SqlTransactionsUnsupportedModesTest.java | 7 +-
.../processors/tx/TxThreadLockingTest.java | 22 +-
.../tx/TxWithExceptionalInterceptorTest.java | 28 +-
.../junit/SystemPropertiesExtension.java | 151 +++++
.../junit/SystemPropertiesList.java} | 22 +-
.../testframework/junit/WithSystemProperty.java | 110 ++++
.../ignite/testsuites/ExecutionTestSuite.java | 8 +-
.../ignite/testsuites/IgniteCalciteTestSuite.java | 8 +-
.../ignite/testsuites/IgniteCalciteTestSuite2.java | 10 +-
.../ignite/testsuites/IgniteCalciteTestSuite3.java | 9 +-
.../ignite/testsuites/IntegrationTestSuite.java | 8 +-
.../apache/ignite/testsuites/JdbcTestSuite.java | 8 +-
.../apache/ignite/testsuites/PlannerTestSuite.java | 8 +-
.../apache/ignite/testsuites/ScriptTestSuite.java | 280 +++++++-
.../apache/ignite/testsuites/UtilTestSuite.java | 8 +-
.../src/test/resources/junit-platform.properties | 14 +
.../testframework/junits/GridAbstractTest.java | 7 +-
.../ignite/tools/junit/JUnitTeamcityReporter.java | 8 +-
.../surefire/testsuites/CheckAllTestsInSuites.java | 13 +-
parent/pom.xml | 3 +
205 files changed, 2976 insertions(+), 1318 deletions(-)
diff --git a/modules/calcite/pom.xml b/modules/calcite/pom.xml
index 01b9833a98c..9fe192fbac7 100644
--- a/modules/calcite/pom.xml
+++ b/modules/calcite/pom.xml
@@ -47,10 +47,26 @@
<commons.math.version>3.6.1</commons.math.version>
<commons.text.version>1.15.0</commons.text.version>
<io.trino.tpch.version>1.2</io.trino.tpch.version>
+ <hamcrest.version>3.0</hamcrest.version>
+ <junit.version>6.1.3</junit.version>
+ <archunit.version>1.5.0</archunit.version>
</properties>
<url>https://ignite.apache.org</url>
+ <dependencyManagement>
+ <dependencies>
+ <!-- Aligns every org.junit.* artifact (including the ones pulled transitively by ArchUnit) to a single version. -->
+ <dependency>
+ <groupId>org.junit</groupId>
+ <artifactId>junit-bom</artifactId>
+ <version>${junit.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -211,6 +227,12 @@
<artifactId>ignite-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -253,6 +275,70 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest</artifactId>
+ <version>${hamcrest.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.tngtech.archunit</groupId>
+ <artifactId>archunit-junit5</artifactId>
+ <version>${archunit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-suite-api</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-engine</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-suite-engine</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Runs the tests that still inherit JUnit 4 test methods from ignite-core test classes. -->
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>io.trino.tpch</groupId>
<artifactId>tpch</artifactId>
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityValueColumnAliasTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityValueColumnAliasTest.java
index 180f72a6723..88afe367453 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityValueColumnAliasTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityValueColumnAliasTest.java
@@ -26,11 +26,11 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
+import org.junit.jupiter.api.Test;
/** */
-public class QueryEntityValueColumnAliasTest extends GridCommonAbstractTest {
+public class QueryEntityValueColumnAliasTest extends GridCommonAbstractWrapperTest {
/** */
private static final String CACHE_NAME = "cache";
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/SessionContextSqlFunctionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/SessionContextSqlFunctionTest.java
index 466e3a50868..f104ae1abc9 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/SessionContextSqlFunctionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/cache/SessionContextSqlFunctionTest.java
@@ -28,18 +28,23 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.resources.SessionContextProviderResource;
import org.apache.ignite.session.SessionContext;
import org.apache.ignite.session.SessionContextProvider;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/** */
-@RunWith(Parameterized.class)
-public class SessionContextSqlFunctionTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "mode={0}, isClnNode={1}")
+@MethodSource("parameters")
+public class SessionContextSqlFunctionTest extends GridCommonAbstractWrapperTest {
/** */
private static final String SESSION_ID = "sessionId";
@@ -47,21 +52,21 @@ public class SessionContextSqlFunctionTest extends GridCommonAbstractTest {
private Ignite ign;
/** */
- @Parameterized.Parameter
+ @Parameter(0)
public CacheAtomicityMode mode;
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public boolean isClnNode;
/** */
- @Parameterized.Parameters(name = "mode={0}, isClnNode={1}")
- public static List<Object[]> parameters() {
- List<Object[]> params = new ArrayList<>();
+ @MethodSource("parameters")
+ private static List<Arguments> parameters() {
+ List<Arguments> params = new ArrayList<>();
for (CacheAtomicityMode m: CacheAtomicityMode.values()) {
- params.add(new Object[] {m, false});
- params.add(new Object[] {m, true});
+ params.add(Arguments.of(m, false));
+ params.add(Arguments.of(m, true));
}
return params;
@@ -83,6 +88,7 @@ public class SessionContextSqlFunctionTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
ign = startGrids(3);
@@ -93,6 +99,7 @@ public class SessionContextSqlFunctionTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() {
stopAllGrids();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorPropertiesTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorPropertiesTest.java
index bd0f3646d74..2b6cbcc263e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorPropertiesTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorPropertiesTest.java
@@ -34,8 +34,7 @@ import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.spi.metric.LongMetric;
import org.apache.ignite.testframework.GridTestUtils;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.QueryParserMetricsHolder.QUERY_PARSER_METRIC_GROUP_NAME;
import static org.apache.ignite.internal.processors.query.calcite.DistributedCalciteConfiguration.DFLT_PLAN_CACHE_SIZE;
import static org.apache.ignite.internal.processors.query.calcite.DistributedCalciteConfiguration.DFLT_RECURSIVE_CTE_ITERATION_LIMIT;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorTest.java
index 5c54c4cad42..5408f05b29d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessorTest.java
@@ -57,10 +57,13 @@ import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import org.hamcrest.CoreMatchers;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.awaitReservationsRelease;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsIndexScan;
@@ -69,13 +72,14 @@ import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
*
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "false")
-public class CalciteQueryProcessorTest extends GridCommonAbstractTest {
+public class CalciteQueryProcessorTest extends GridCommonAbstractWrapperTest {
/** */
private static IgniteEx client;
@@ -96,6 +100,7 @@ public class CalciteQueryProcessorTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
startGrids(5);
@@ -103,6 +108,7 @@ public class CalciteQueryProcessorTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws InterruptedException {
for (Ignite ign : G.allGrids()) {
for (String cacheName : ign.cacheNames())
@@ -117,11 +123,6 @@ public class CalciteQueryProcessorTest extends GridCommonAbstractTest {
awaitPartitionMapExchange();
}
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() {
- stopAllGrids();
- }
-
/**
* Test verifies that replicated cache with specified cache group
* could be properly mapped on server nodes.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java
index da4dfdd1d87..bf8dc446156 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java
@@ -35,9 +35,9 @@ import org.apache.ignite.internal.processors.query.calcite.metadata.RemoteExcept
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static java.util.Collections.singletonList;
import static org.apache.ignite.cache.query.QueryCancelledException.ERR_MSG;
@@ -46,9 +46,10 @@ import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.a
/**
* Cancel query test.
*/
-public class CancelTest extends GridCommonAbstractTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
+public class CancelTest extends GridCommonAbstractWrapperTest {
+ /** */
+ @BeforeEach
+ void setup() throws Exception {
startGrids(2);
IgniteCache<Integer, String> c = grid(0).cache("TEST");
@@ -57,6 +58,7 @@ public class CancelTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
stopAllGrids();
@@ -153,7 +155,7 @@ public class CancelTest extends GridCommonAbstractTest {
fail("Unexpected exception: " + ex);
}
- Assert.assertTrue(GridTestUtils.waitForCondition(
+ assertTrue(GridTestUtils.waitForCondition(
() -> engine.runningQueries().isEmpty(), 10_000));
awaitReservationsRelease(grid(0), "TEST");
@@ -180,7 +182,7 @@ public class CancelTest extends GridCommonAbstractTest {
CalciteQueryProcessor engine1 = (CalciteQueryProcessor)Commons.lookupComponent(
grid(1).context(), QueryEngine.class);
- Assert.assertTrue(GridTestUtils.waitForCondition(
+ assertTrue(GridTestUtils.waitForCondition(
() -> engine1.runningQueries().isEmpty(), 10_000));
awaitReservationsRelease(grid(1), "TEST");
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/GridCommonAbstractWrapperTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/GridCommonAbstractWrapperTest.java
new file mode 100644
index 00000000000..c4ee3ad71ec
--- /dev/null
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/GridCommonAbstractWrapperTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query.calcite;
+
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.TestInstance;
+
+import static org.apache.ignite.tools.junit.JUnitTeamcityReporter.escapeForTeamcity;
+
+/** */
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class GridCommonAbstractWrapperTest extends GridCommonAbstractTest {
+ /** */
+ @BeforeEach
+ void beforeTest(TestInfo testInfo) {
+ printTestName(testInfo, true);
+ }
+
+ /** */
+ @AfterEach
+ void afterTest(TestInfo testInfo) {
+ printTestName(testInfo, false);
+ }
+
+ /** Get and print the display name of the upcoming test. */
+ private void printTestName(TestInfo testInfo, boolean start) {
+ // Get and print the display name of the upcoming test
+ String testName = testInfo.getDisplayName();
+ String testCls = testInfo.getTestClass().orElse(Object.class).getSimpleName();
+
+ String testFullName = escapeForTeamcity(testCls + "#" + testName);
+
+ if (start)
+ U.quietAndInfo(log(), ">>> Starting test: " + testFullName + " <<<");
+ else
+ U.quietAndInfo(log(), ">>> Stopping test: " + testFullName + " <<<");
+ }
+
+ /** */
+ @BeforeAll
+ void init() {
+ beforeFirstTest0();
+ }
+
+ /** {@inheritDoc} */
+ @AfterAll
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryChecker.java
index 67534cee626..43244fcfa07 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryChecker.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryChecker.java
@@ -54,9 +54,10 @@ import org.hamcrest.Matcher;
import org.hamcrest.core.SubstringMatcher;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Query checker.
@@ -217,36 +218,56 @@ public abstract class QueryChecker {
/** */
public static Matcher<String> matches(final String substring) {
- return new SubstringMatcher(substring) {
+ return new SubstringMatcher("contains", false, substring) {
/** {@inheritDoc} */
@Override protected boolean evalSubstringOf(String sIn) {
sIn = sIn.replaceAll("\n", "");
return sIn.matches(substring);
}
+ };
+ }
+ /** Matches only one occurrence. */
+ static Matcher<String> matchesOnce(String pattern) {
+ return occursTimes(pattern, 1, true);
+ }
+
+ /** Has specified number of occurrence. */
+ static Matcher<String> occursTimes(String pattern, int times, boolean noMore) {
+ return new SubstringMatcher(resolveRelation(times, noMore), false, pattern) {
/** {@inheritDoc} */
- @Override protected String relationship() {
- return null;
+ @Override protected boolean evalSubstringOf(String strIn) {
+ strIn = strIn.replaceAll(System.lineSeparator(), "");
+
+ return contains(strIn, substring, times, noMore);
}
};
}
- /** Matches only one occurance. */
- public static Matcher<String> matchesOnce(final String substring) {
- return new SubstringMatcher(substring) {
- /** {@inheritDoc} */
- @Override protected boolean evalSubstringOf(String sIn) {
- sIn = sIn.replaceAll("\n", "");
+ /** */
+ private static String resolveRelation(int times, boolean noMore) {
+ assertTrue(times >= 0, "Found: " + times);
- return containsOnce(sIn, substring);
- }
+ return switch (times) {
+ case 0 -> noMore ? "does not contain" : "can contain";
+ case 1 -> noMore ? "contains once" : "contains only once";
+ default -> (noMore ? "contains " : "contains only ") + times + " times";
+ };
+ }
- /** {@inheritDoc} */
- @Override protected String relationship() {
- return null;
+ /** Check that {@code s} contains {@code substring} {@code times} times. */
+ static boolean contains(String s, CharSequence substring, int times, boolean noMore) {
+ Pattern pattern = Pattern.compile(substring.toString());
+ java.util.regex.Matcher matcher = pattern.matcher(s);
+
+ for (int i = 0; i < times; i++) {
+ if (!matcher.find()) {
+ return false; // Not enough occurrences
}
- };
+ }
+
+ return !noMore || !matcher.find();
}
/** Check only single matching. */
@@ -466,7 +487,7 @@ public abstract class QueryChecker {
res = cur.getAll();
if (expectedResultSize >= 0)
- assertEquals("Unexpected result size", expectedResultSize, res.size());
+ assertEquals(expectedResultSize, res.size(), "Unexpected result size");
if (resultChecker != null)
resultChecker.accept(res);
@@ -491,7 +512,7 @@ public abstract class QueryChecker {
* @param act Actual collection.
*/
private void assertEqualsCollections(Collection<?> exp, Collection<?> act) {
- assertEquals("Collections sizes are not equal:\nExpected: " + exp + "\nActual: " + act, exp.size(), act.size());
+ assertEquals(exp.size(), act.size(), "Collections sizes are not equal:\nExpected: " + exp + "\nActual: " + act);
Iterator<?> it1 = exp.iterator();
Iterator<?> it2 = act.iterator();
@@ -581,6 +602,6 @@ public abstract class QueryChecker {
}, PART_RELEASE_TIMEOUT);
for (GridDhtLocalPartition p : parts)
- assertEquals("Partition is reserved: [node=" + node.name() + ", part=" + p, 0, p.reservations());
+ assertEquals(0, p.reservations(), "Partition is reserved: [node=" + node.name() + ", part=" + p);
}
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryCheckerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryCheckerTest.java
index d125e3ddb08..22bce273a7e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryCheckerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/QueryCheckerTest.java
@@ -18,12 +18,12 @@
package org.apache.ignite.internal.processors.query.calcite;
import org.hamcrest.Matcher;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsResultRowCount;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.matchesOnce;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/** Query checker tests. */
public class QueryCheckerTest {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/SqlFieldsQueryUsageTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/SqlFieldsQueryUsageTest.java
index 1eb9bb76268..85791cf5dee 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/SqlFieldsQueryUsageTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/SqlFieldsQueryUsageTest.java
@@ -27,14 +27,14 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.AfterClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import static java.util.Collections.singletonList;
/** */
-public class SqlFieldsQueryUsageTest extends GridCommonAbstractTest {
+public class SqlFieldsQueryUsageTest extends GridCommonAbstractWrapperTest {
/** */
private static IgniteEx client;
@@ -44,15 +44,16 @@ public class SqlFieldsQueryUsageTest extends GridCommonAbstractTest {
new SqlConfiguration().setQueryEnginesConfiguration(new CalciteQueryEngineConfiguration()));
}
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
+ /** */
+ @BeforeAll
+ void setup() throws Exception {
startGrids(1);
client = startClientGrid();
}
/** */
- @AfterClass
+ @AfterAll
public static void tearDown() {
G.stopAll(false);
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolderTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolderTest.java
index 0310edd8049..6ebe500178f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolderTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolderTest.java
@@ -23,17 +23,16 @@ import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
*
*/
-public class ClosableIteratorsHolderTest extends GridCommonAbstractTest {
+public class ClosableIteratorsHolderTest extends GridCommonAbstractWrapperTest {
/** */
private static final int GENERATED = 10000;
@@ -44,7 +43,7 @@ public class ClosableIteratorsHolderTest extends GridCommonAbstractTest {
private ClosableIteratorsHolder holder;
/** */
- @Before
+ @BeforeEach
public void setup() throws Exception {
iterators = Collections.newSetFromMap(new ConcurrentHashMap<>());
holder = new ClosableIteratorsHolder(log());
@@ -52,7 +51,7 @@ public class ClosableIteratorsHolderTest extends GridCommonAbstractTest {
}
/** */
- @After
+ @AfterEach
public void tearDown() throws Exception {
holder.tearDown();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/KeyFilteringCursorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/KeyFilteringCursorTest.java
index a5f8bb514d8..dfcc96c5166 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/KeyFilteringCursorTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/KeyFilteringCursorTest.java
@@ -39,9 +39,8 @@ import org.apache.ignite.internal.processors.cache.transactions.TransactionChang
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/** */
public class KeyFilteringCursorTest {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementorTest.java
index 3e87461ea0b..a0563bf1e8b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementorTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementorTest.java
@@ -38,6 +38,7 @@ import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.util.ImmutableBitSet;
import org.apache.calcite.util.mapping.Mappings;
import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.exec.exp.RangeIterable;
import org.apache.ignite.internal.processors.query.calcite.exec.rel.CollectNode;
import org.apache.ignite.internal.processors.query.calcite.exec.rel.IndexSpoolNode;
@@ -62,16 +63,15 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.processors.query.calcite.util.RexUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.tools.Frameworks.createRootSchema;
/**
* Test LogicalRelImplementor class.
*/
-public class LogicalRelImplementorTest extends GridCommonAbstractTest {
+public class LogicalRelImplementorTest extends GridCommonAbstractWrapperTest {
/** */
private LogicalRelImplementor<Object[]> relImplementor;
@@ -91,8 +91,9 @@ public class LogicalRelImplementorTest extends GridCommonAbstractTest {
private IgniteTypeFactory tf;
/** */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
+ @BeforeEach
+ void setup() throws Exception {
+ beforeTest();
tf = Commons.typeFactory();
RelDataTypeFactory.Builder b = new RelDataTypeFactory.Builder(tf);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/NumericTypesPrecisionsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/NumericTypesPrecisionsTest.java
index e582e24b72a..496820c988e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/NumericTypesPrecisionsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/NumericTypesPrecisionsTest.java
@@ -24,9 +24,9 @@ import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/** Test for numeric types precisions. */
public class NumericTypesPrecisionsTest {
@@ -196,7 +196,7 @@ public class NumericTypesPrecisionsTest {
for (int i = 0; i < TEST_SUITE.length; ++i) {
RelDataType actualType = TYPE_FACTORY.leastRestrictive(Arrays.asList(testType, TEST_SUITE[i]));
- assertEquals("leastRestrictive(" + testType + ", " + TEST_SUITE[i] + ")", expectedLeast[i], actualType);
+ assertEquals(expectedLeast[i], actualType, "leastRestrictive(" + testType + ", " + TEST_SUITE[i] + ")");
}
}
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeSortedIndexTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeSortedIndexTest.java
index 66dfd58362f..868008d95f8 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeSortedIndexTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeSortedIndexTest.java
@@ -30,19 +30,19 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.util.ImmutableIntList;
import org.apache.calcite.util.Pair;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.exec.tracker.NoOpIoTracker;
import org.apache.ignite.internal.processors.query.calcite.exec.tracker.NoOpMemoryTracker;
import org.apache.ignite.internal.processors.query.calcite.prepare.BaseQueryContext;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.lang.GridCursor;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
*/
-public class RuntimeSortedIndexTest extends GridCommonAbstractTest {
+public class RuntimeSortedIndexTest extends GridCommonAbstractWrapperTest {
/** */
private static final int UNIQUE_GROUPS = 10_000;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctionsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctionsTest.java
index b6c1e4afd93..ee9cd6d551c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctionsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctionsTest.java
@@ -18,8 +18,11 @@
package org.apache.ignite.internal.processors.query.calcite.exec.exp;
import java.math.BigDecimal;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
*
@@ -28,70 +31,70 @@ public class IgniteSqlFunctionsTest {
/** */
@Test
public void testBigDecimalToString() {
- Assert.assertNull(IgniteSqlFunctions.toString((BigDecimal)null));
+ assertNull(IgniteSqlFunctions.toString((BigDecimal)null));
- Assert.assertEquals(
+ assertEquals(
"10",
IgniteSqlFunctions.toString(BigDecimal.valueOf(10))
);
- Assert.assertEquals(
+ assertEquals(
"9223372036854775807",
IgniteSqlFunctions.toString(BigDecimal.valueOf(Long.MAX_VALUE))
);
- Assert.assertEquals(
+ assertEquals(
"340282350000000000000000000000000000000",
IgniteSqlFunctions.toString(new BigDecimal(String.valueOf(Float.MAX_VALUE)))
);
- Assert.assertEquals(
+ assertEquals(
"-340282346638528860000000000000000000000",
IgniteSqlFunctions.toString(BigDecimal.valueOf(-Float.MAX_VALUE))
);
}
/** */
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testBooleanPrimitiveToBigDecimal() {
- IgniteSqlFunctions.toBigDecimal(true, 10, 10);
+ assertThrows(UnsupportedOperationException.class, () -> IgniteSqlFunctions.toBigDecimal(true, 10, 10));
}
/** */
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testBooleanObjectToBigDecimal() {
- IgniteSqlFunctions.toBigDecimal(Boolean.valueOf(true), 10, 10);
+ assertThrows(UnsupportedOperationException.class, () -> IgniteSqlFunctions.toBigDecimal(Boolean.valueOf(true), 10, 10));
}
/** */
@Test
public void testPrimitiveToDecimal() {
- Assert.assertEquals(
+ assertEquals(
new BigDecimal(10),
IgniteSqlFunctions.toBigDecimal((byte)10, 10, 0)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal(10),
IgniteSqlFunctions.toBigDecimal((short)10, 10, 0)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal(10),
IgniteSqlFunctions.toBigDecimal(10, 10, 0)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal("10.0"),
IgniteSqlFunctions.toBigDecimal(10L, 10, 1)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal("10.101"),
IgniteSqlFunctions.toBigDecimal(10.101f, 10, 3)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal("10.101"),
IgniteSqlFunctions.toBigDecimal(10.101d, 10, 3)
);
@@ -100,38 +103,38 @@ public class IgniteSqlFunctionsTest {
/** */
@Test
public void testObjectToDecimal() {
- Assert.assertNull(IgniteSqlFunctions.toBigDecimal((Object)null, 10, 0));
+ assertNull(IgniteSqlFunctions.toBigDecimal((Object)null, 10, 0));
- Assert.assertNull(IgniteSqlFunctions.toBigDecimal((Double)null, 10, 0));
+ assertNull(IgniteSqlFunctions.toBigDecimal((Double)null, 10, 0));
- Assert.assertNull(IgniteSqlFunctions.toBigDecimal((String)null, 10, 0));
+ assertNull(IgniteSqlFunctions.toBigDecimal((String)null, 10, 0));
- Assert.assertEquals(
+ assertEquals(
new BigDecimal(10),
- IgniteSqlFunctions.toBigDecimal(new Byte("10"), 10, 0)
+ IgniteSqlFunctions.toBigDecimal(Byte.valueOf("10"), 10, 0)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal(10),
IgniteSqlFunctions.toBigDecimal(Short.valueOf("10"), 10, 0)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal(10),
IgniteSqlFunctions.toBigDecimal(Integer.valueOf(10), 10, 0)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal("10.0"),
IgniteSqlFunctions.toBigDecimal(Long.valueOf(10L), 10, 1)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal("10.101"),
IgniteSqlFunctions.toBigDecimal(Float.valueOf(10.101f), 10, 3)
);
- Assert.assertEquals(
+ assertEquals(
new BigDecimal("10.101"),
IgniteSqlFunctions.toBigDecimal(Double.valueOf(10.101d), 10, 3)
);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale001Test.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractExecutionParametrizedTest.java
similarity index 69%
copy from modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale001Test.java
copy to modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractExecutionParametrizedTest.java
index 205cdea3339..c790a80a2ed 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale001Test.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractExecutionParametrizedTest.java
@@ -15,16 +15,13 @@
* limitations under the License.
*/
-package org.apache.ignite.internal.processors.query.calcite.integration.tpch;
+package org.apache.ignite.internal.processors.query.calcite.exec.rel;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
/** */
-@RunWith(Parameterized.class)
-public class TpchScale001Test extends AbstractTpchTest {
- /** {@inheritDoc} */
- @Override protected double scale() {
- return 0.01;
- }
+@ParameterizedClass(name = "Task executor = {0}, Execution strategy = {1}")
+@MethodSource("parameters")
+public class AbstractExecutionParametrizedTest extends AbstractExecutionTest{
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractExecutionTest.java
index b7f5880259b..4f40c3e90a9 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractExecutionTest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.pool.PoolProcessor;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.QueryRegistryImpl;
import org.apache.ignite.internal.processors.query.calcite.exec.ArrayRowHandler;
import org.apache.ignite.internal.processors.query.calcite.exec.ExchangeService;
@@ -66,26 +67,20 @@ import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.NotNull;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.provider.Arguments;
import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
/**
*
*/
-@RunWith(Parameterized.class)
-public class AbstractExecutionTest extends GridCommonAbstractTest {
+public class AbstractExecutionTest extends GridCommonAbstractWrapperTest {
/** Last parameter number. */
protected static final int LAST_PARAM_NUM = 1;
- /** Params string. */
- protected static final String PARAMS_STRING = "Task executor = {0}, Execution strategy = {1}";
-
/** */
public static final int IN_BUFFER_SIZE = AbstractNode.IN_BUFFER_SIZE;
@@ -156,9 +151,21 @@ public class AbstractExecutionTest extends GridCommonAbstractTest {
}
}
+ /** Task executor. */
+ @Parameter(0)
+ public TaskExecutorType taskExecutorType;
+
+ /** Execution direction. */
+ @Parameter(LAST_PARAM_NUM)
+ public ExecutionStrategy execStgy;
+
/** */
- @Parameterized.Parameters(name = PARAMS_STRING)
- public static List<Object[]> parameters() {
+ public static Stream<Arguments> parameters() {
+ return innerParams().stream().map(Arguments::of);
+ }
+
+ /** */
+ static List<Object[]> innerParams() {
List<Object[]> params = Stream.of(ExecutionStrategy.values())
.map(s -> new Object[] {TaskExecutorType.STRIPED, s})
.collect(Collectors.toList());
@@ -168,16 +175,8 @@ public class AbstractExecutionTest extends GridCommonAbstractTest {
return params;
}
- /** Task executor. */
- @Parameterized.Parameter
- public TaskExecutorType taskExecutorType;
-
- /** Execution direction. */
- @Parameterized.Parameter(LAST_PARAM_NUM)
- public ExecutionStrategy execStgy;
-
/** */
- @Before
+ @BeforeEach
public void setup() throws Exception {
nodes = IntStream.range(0, nodesCnt)
.mapToObj(i -> UUID.randomUUID()).collect(Collectors.toList());
@@ -311,7 +310,7 @@ public class AbstractExecutionTest extends GridCommonAbstractTest {
}
/** */
- @After
+ @AfterEach
public void tearDown() {
taskExecutors.values().forEach(AbstractQueryTaskExecutor::tearDown);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpExecutionTest.java
index 452e1633c84..0e18f6ea870 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpExecutionTest.java
@@ -34,22 +34,22 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.Aggregat
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.MAP;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.REDUCE;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.SINGLE;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
/**
* Abstract test for set operator (MINUS, INTERSECT) execution.
*/
-public abstract class AbstractSetOpExecutionTest extends AbstractExecutionTest {
+public abstract class AbstractSetOpExecutionTest extends AbstractExecutionParametrizedTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
@@ -165,7 +165,7 @@ public abstract class AbstractSetOpExecutionTest extends AbstractExecutionTest {
assertTrue(F.isEmpty(expectedResult) || root.hasNext());
for (Object[] row : expectedResult)
- Assert.assertArrayEquals(row, root.next());
+ assertArrayEquals(row, root.next());
assertFalse(root.hasNext());
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/BaseAggregateTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/BaseAggregateTest.java
index b0bfe89e976..197835a201d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/BaseAggregateTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/BaseAggregateTest.java
@@ -45,42 +45,41 @@ import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runners.Parameterized;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
/**
*
*/
@SuppressWarnings("TypeMayBeWeakened")
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
+@ParameterizedClass(name = "Task executor = {0}, Execution strategy = {1}, testAgg={2}")
+@MethodSource("data")
public abstract class BaseAggregateTest extends AbstractExecutionTest {
/** Last parameter number. */
protected static final int TEST_AGG_PARAM_NUM = LAST_PARAM_NUM + 1;
/** */
- @Parameterized.Parameter(TEST_AGG_PARAM_NUM)
+ @Parameter(TEST_AGG_PARAM_NUM)
public TestAggregateType testAgg;
/** */
- @Parameterized.Parameters(name = PARAMS_STRING + ", type={" + TEST_AGG_PARAM_NUM + "}")
- public static List<Object[]> data() {
- List<Object[]> extraParams = new ArrayList<>();
+ private static List<Arguments> data() {
+ List<Arguments> extraParams = new ArrayList<>();
- ImmutableList<Object[]> newParams = ImmutableList.of(
- new Object[] {TestAggregateType.SINGLE},
- new Object[] {TestAggregateType.MAP_REDUCE}
- );
-
- for (Object[] newParam : newParams) {
- for (Object[] inheritedParam : AbstractExecutionTest.parameters()) {
- Object[] both = Stream.concat(Arrays.stream(inheritedParam), Arrays.stream(newParam))
- .toArray(Object[]::new);
-
- extraParams.add(both);
- }
+ for (TestAggregateType newParam : TestAggregateType.values()) {
+ for (Object[] inheritedParam : innerParams())
+ extraParams.add(Arguments.from(Stream.concat(Arrays.stream(inheritedParam), Stream.of(newParam)).toList()));
}
return extraParams;
@@ -89,7 +88,7 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
@@ -138,8 +137,8 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, 2), root.next());
- Assert.assertArrayEquals(row(1, 2), root.next());
+ assertArrayEquals(row(0, 2), root.next());
+ assertArrayEquals(row(1, 2), root.next());
assertFalse(root.hasNext());
}
@@ -187,8 +186,8 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, 200), root.next());
- Assert.assertArrayEquals(row(1, 300), root.next());
+ assertArrayEquals(row(0, 200), root.next());
+ assertArrayEquals(row(1, 300), root.next());
assertFalse(root.hasNext());
}
@@ -236,8 +235,8 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, 1000), root.next());
- Assert.assertArrayEquals(row(1, 1400), root.next());
+ assertArrayEquals(row(0, 1000), root.next());
+ assertArrayEquals(row(1, 1400), root.next());
assertFalse(root.hasNext());
}
@@ -285,8 +284,8 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, 600), root.next());
- Assert.assertArrayEquals(row(1, 800), root.next());
+ assertArrayEquals(row(0, 600), root.next());
+ assertArrayEquals(row(1, 800), root.next());
assertFalse(root.hasNext());
}
@@ -375,8 +374,8 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
Runnable r = () -> {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, output[0]), root.next());
- Assert.assertArrayEquals(row(1, output[1]), root.next());
+ assertArrayEquals(row(0, output[0]), root.next());
+ assertArrayEquals(row(1, output[1]), root.next());
assertFalse(root.hasNext());
};
@@ -435,8 +434,8 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, 1200), root.next());
- Assert.assertArrayEquals(row(1, 500), root.next());
+ assertArrayEquals(row(0, 1200), root.next());
+ assertArrayEquals(row(1, 500), root.next());
assertFalse(root.hasNext());
}
@@ -550,7 +549,7 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, (long)Integer.MAX_VALUE / 2 + (long)Integer.MAX_VALUE / 2 + 11L), root.next());
+ assertArrayEquals(row(0, (long)Integer.MAX_VALUE / 2 + (long)Integer.MAX_VALUE / 2 + 11L), root.next());
assertFalse(root.hasNext());
}
@@ -596,7 +595,7 @@ public abstract class BaseAggregateTest extends AbstractExecutionTest {
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0, new BigDecimal(Long.MAX_VALUE).add(new BigDecimal(10))), root.next());
+ assertArrayEquals(row(0, new BigDecimal(Long.MAX_VALUE).add(new BigDecimal(10))), root.next());
assertFalse(root.hasNext());
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java
index 435c8e6e670..988712a82ce 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ContinuousExecutionTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.query.calcite.exec.rel;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
@@ -35,15 +36,21 @@ import org.apache.ignite.internal.processors.query.calcite.trait.AllNodes;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
*
*/
@SuppressWarnings("TypeMayBeWeakened")
+@ParameterizedClass(name = "Task executor = {0}, Execution strategy = {1}, " +
+ "rowsCount={2}, " +
+ "remoteFragmentsCount={3}")
+@MethodSource("params")
public class ContinuousExecutionTest extends AbstractExecutionTest {
/** Row count parameter number. */
protected static final int ROW_CNT_PARAM_NUM = LAST_PARAM_NUM + 1;
@@ -60,11 +67,8 @@ public class ContinuousExecutionTest extends AbstractExecutionTest {
public int remoteFragmentsCnt;
/** */
- @Parameterized.Parameters(name = PARAMS_STRING + ", " +
- "rowsCount={" + ROW_CNT_PARAM_NUM + "}, " +
- "remoteFragmentsCount={" + REMOTE_FRAGMENTS_PARAM_NUM + "}")
- public static List<Object[]> data() {
- List<Object[]> extraParams = new ArrayList<>();
+ public static Collection<Arguments> params() {
+ List<Arguments> extraParams = new ArrayList<>();
ImmutableList<Object[]> newParams = ImmutableList.of(
new Object[] {10, 1},
@@ -79,12 +83,8 @@ public class ContinuousExecutionTest extends AbstractExecutionTest {
);
for (Object[] newParam : newParams) {
- for (Object[] inheritedParam : AbstractExecutionTest.parameters()) {
- Object[] both = Stream.concat(Arrays.stream(inheritedParam), Arrays.stream(newParam))
- .toArray(Object[]::new);
-
- extraParams.add(both);
- }
+ for (Object[] inheritedParam : innerParams())
+ extraParams.add(Arguments.from(Stream.concat(Arrays.stream(inheritedParam), Stream.of(newParam)).toList()));
}
return extraParams;
@@ -93,7 +93,7 @@ public class ContinuousExecutionTest extends AbstractExecutionTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = remoteFragmentsCnt + 1;
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ExecutionTest.java
index 6ab1ea04565..63cb4af061d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ExecutionTest.java
@@ -33,10 +33,11 @@ import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static java.lang.Math.max;
import static java.lang.Math.min;
@@ -47,17 +48,19 @@ import static org.apache.calcite.rel.core.JoinRelType.LEFT;
import static org.apache.calcite.rel.core.JoinRelType.RIGHT;
import static org.apache.calcite.rel.core.JoinRelType.SEMI;
import static org.apache.ignite.internal.processors.query.calcite.util.Commons.getFieldFromBiRows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
/**
*
*/
@SuppressWarnings("TypeMayBeWeakened")
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
-public class ExecutionTest extends AbstractExecutionTest {
+public class ExecutionTest extends AbstractExecutionParametrizedTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
@@ -122,8 +125,8 @@ public class ExecutionTest extends AbstractExecutionTest {
assertEquals(2, rows.size());
- Assert.assertArrayEquals(new Object[] {2, "Ivan", "Calcite"}, rows.get(0));
- Assert.assertArrayEquals(new Object[] {2, "Ivan", "Ignite"}, rows.get(1));
+ assertArrayEquals(new Object[] {2, "Ivan", "Calcite"}, rows.get(0));
+ assertArrayEquals(new Object[] {2, "Ivan", "Ignite"}, rows.get(1));
}
/**
@@ -227,10 +230,10 @@ public class ExecutionTest extends AbstractExecutionTest {
assertEquals(4, rows.size());
- Assert.assertArrayEquals(new Object[] {0, "Igor", "Core"}, rows.get(0));
- Assert.assertArrayEquals(new Object[] {1, "Roman", "SQL"}, rows.get(1));
- Assert.assertArrayEquals(new Object[] {2, "Ivan", null}, rows.get(2));
- Assert.assertArrayEquals(new Object[] {3, "Alexey", "Core"}, rows.get(3));
+ assertArrayEquals(new Object[] {0, "Igor", "Core"}, rows.get(0));
+ assertArrayEquals(new Object[] {1, "Roman", "SQL"}, rows.get(1));
+ assertArrayEquals(new Object[] {2, "Ivan", null}, rows.get(2));
+ assertArrayEquals(new Object[] {3, "Alexey", "Core"}, rows.get(3));
}
/**
@@ -288,10 +291,10 @@ public class ExecutionTest extends AbstractExecutionTest {
assertEquals(4, rows.size());
- Assert.assertArrayEquals(new Object[] {0, "Igor", "Core"}, rows.get(0));
- Assert.assertArrayEquals(new Object[] {3, "Alexey", "Core"}, rows.get(1));
- Assert.assertArrayEquals(new Object[] {1, "Roman", "SQL"}, rows.get(2));
- Assert.assertArrayEquals(new Object[] {2, "Ivan", null}, rows.get(3));
+ assertArrayEquals(new Object[] {0, "Igor", "Core"}, rows.get(0));
+ assertArrayEquals(new Object[] {3, "Alexey", "Core"}, rows.get(1));
+ assertArrayEquals(new Object[] {1, "Roman", "SQL"}, rows.get(2));
+ assertArrayEquals(new Object[] {2, "Ivan", null}, rows.get(3));
}
/**
@@ -349,11 +352,11 @@ public class ExecutionTest extends AbstractExecutionTest {
assertEquals(5, rows.size());
- Assert.assertArrayEquals(new Object[] {0, "Igor", "Core"}, rows.get(0));
- Assert.assertArrayEquals(new Object[] {1, "Roman", "SQL"}, rows.get(1));
- Assert.assertArrayEquals(new Object[] {2, "Ivan", null}, rows.get(2));
- Assert.assertArrayEquals(new Object[] {3, "Alexey", "Core"}, rows.get(3));
- Assert.assertArrayEquals(new Object[] {null, null, "QA"}, rows.get(4));
+ assertArrayEquals(new Object[] {0, "Igor", "Core"}, rows.get(0));
+ assertArrayEquals(new Object[] {1, "Roman", "SQL"}, rows.get(1));
+ assertArrayEquals(new Object[] {2, "Ivan", null}, rows.get(2));
+ assertArrayEquals(new Object[] {3, "Alexey", "Core"}, rows.get(3));
+ assertArrayEquals(new Object[] {null, null, "QA"}, rows.get(4));
}
/**
@@ -410,8 +413,8 @@ public class ExecutionTest extends AbstractExecutionTest {
assertEquals(2, rows.size());
- Assert.assertArrayEquals(new Object[] {"Core"}, rows.get(0));
- Assert.assertArrayEquals(new Object[] {"SQL"}, rows.get(1));
+ assertArrayEquals(new Object[] {"Core"}, rows.get(0));
+ assertArrayEquals(new Object[] {"SQL"}, rows.get(1));
}
/**
@@ -468,7 +471,7 @@ public class ExecutionTest extends AbstractExecutionTest {
assertEquals(1, rows.size());
- Assert.assertArrayEquals(new Object[] {"QA"}, rows.get(0));
+ assertArrayEquals(new Object[] {"QA"}, rows.get(0));
}
/**
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateExecutionTest.java
index 95b8ae9a434..c6fb167c07c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateExecutionTest.java
@@ -36,18 +36,21 @@ import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Assert;
-import org.junit.Test;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.MAP;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.REDUCE;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.SINGLE;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
/**
*
*/
@SuppressWarnings("TypeMayBeWeakened")
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
public class HashAggregateExecutionTest extends BaseAggregateTest {
/** {@inheritDoc} */
@@ -200,7 +203,7 @@ public class HashAggregateExecutionTest extends BaseAggregateTest {
root.register(aggChain);
assertTrue(root.hasNext());
- Assert.assertArrayEquals(row(0), root.next());
+ assertArrayEquals(row(0), root.next());
assertFalse(root.hasNext());
aggChain.rewind();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateSingleGroupExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateSingleGroupExecutionTest.java
index 1b4ee59c5bb..65cbb108bea 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateSingleGroupExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateSingleGroupExecutionTest.java
@@ -39,9 +39,11 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.MAP;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.REDUCE;
@@ -51,12 +53,13 @@ import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.A
*
*/
@SuppressWarnings("TypeMayBeWeakened")
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
-public class HashAggregateSingleGroupExecutionTest extends AbstractExecutionTest {
+public class HashAggregateSingleGroupExecutionTest extends AbstractExecutionParametrizedTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
@@ -452,7 +455,6 @@ public class HashAggregateSingleGroupExecutionTest extends AbstractExecutionTest
assertFalse(root.hasNext());
}
-
/** */
@Test
public void singleCount() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashIndexSpoolExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashIndexSpoolExecutionTest.java
index 5536e48439f..9ceff6d05e7 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashIndexSpoolExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashIndexSpoolExecutionTest.java
@@ -30,20 +30,23 @@ import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.lang.GridTuple3;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import org.jetbrains.annotations.NotNull;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
/**
*
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
-public class HashIndexSpoolExecutionTest extends AbstractExecutionTest {
+public class HashIndexSpoolExecutionTest extends AbstractExecutionParametrizedTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinExecutionTest.java
index d1a1e81c4d4..019dc0f42ca 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinExecutionTest.java
@@ -31,8 +31,7 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.rel.core.JoinRelType.ANTI;
import static org.apache.calcite.rel.core.JoinRelType.FULL;
import static org.apache.calcite.rel.core.JoinRelType.INNER;
@@ -41,7 +40,7 @@ import static org.apache.calcite.rel.core.JoinRelType.RIGHT;
import static org.apache.calcite.rel.core.JoinRelType.SEMI;
/** */
-public class HashJoinExecutionTest extends AbstractExecutionTest {
+public class HashJoinExecutionTest extends AbstractExecutionParametrizedTest {
/** */
@Test
public void testHashJoinRewind() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/JoinBuffersExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/JoinBuffersExecutionTest.java
index 0d52216bd98..9a29c1c1524 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/JoinBuffersExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/JoinBuffersExecutionTest.java
@@ -33,7 +33,7 @@ import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.rel.core.JoinRelType.ANTI;
import static org.apache.calcite.rel.core.JoinRelType.FULL;
@@ -43,7 +43,7 @@ import static org.apache.calcite.rel.core.JoinRelType.RIGHT;
import static org.apache.calcite.rel.core.JoinRelType.SEMI;
/** Tests that buffers of join nodes are cleared at the join end and that a join node is not stuck. */
-public class JoinBuffersExecutionTest extends AbstractExecutionTest {
+public class JoinBuffersExecutionTest extends AbstractExecutionParametrizedTest {
/** */
@Test
public void testMergeJoinBuffers() throws Exception {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitExecutionTest.java
index fda6deaacc9..d732f61f364 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitExecutionTest.java
@@ -28,12 +28,12 @@ import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test LimitNode execution.
*/
-public class LimitExecutionTest extends AbstractExecutionTest {
+public class LimitExecutionTest extends AbstractExecutionParametrizedTest {
/** */
@Test
public void testLimit() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java
index c54b1225474..da81912bdff 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java
@@ -27,9 +27,8 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.rel.core.JoinRelType.ANTI;
import static org.apache.calcite.rel.core.JoinRelType.FULL;
@@ -37,18 +36,19 @@ import static org.apache.calcite.rel.core.JoinRelType.INNER;
import static org.apache.calcite.rel.core.JoinRelType.LEFT;
import static org.apache.calcite.rel.core.JoinRelType.RIGHT;
import static org.apache.calcite.rel.core.JoinRelType.SEMI;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
/** */
@SuppressWarnings("TypeMayBeWeakened")
-public class MergeJoinExecutionTest extends AbstractExecutionTest {
+public class MergeJoinExecutionTest extends AbstractExecutionParametrizedTest {
/** */
public static final Object[][] EMPTY = new Object[0][];
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
@@ -452,7 +452,7 @@ public class MergeJoinExecutionTest extends AbstractExecutionTest {
while (node.hasNext())
rows.add(node.next());
- Assert.assertThat(rows.toArray(EMPTY), equalTo(expRes));
+ assertThat(rows.toArray(EMPTY), equalTo(expRes));
}
/**
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinExecutionTest.java
index d9a00d68233..bf13826b72b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinExecutionTest.java
@@ -28,10 +28,11 @@ import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext
import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.calcite.rel.core.JoinRelType.ANTI;
import static org.apache.calcite.rel.core.JoinRelType.FULL;
@@ -40,18 +41,20 @@ import static org.apache.calcite.rel.core.JoinRelType.LEFT;
import static org.apache.calcite.rel.core.JoinRelType.RIGHT;
import static org.apache.calcite.rel.core.JoinRelType.SEMI;
import static org.apache.ignite.internal.processors.query.calcite.util.Commons.getFieldFromBiRows;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
/** */
@SuppressWarnings("TypeMayBeWeakened")
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
-public class NestedLoopJoinExecutionTest extends AbstractExecutionTest {
+public class NestedLoopJoinExecutionTest extends AbstractExecutionParametrizedTest {
/** */
public static final Object[][] EMPTY = new Object[0][];
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
@@ -365,7 +368,7 @@ public class NestedLoopJoinExecutionTest extends AbstractExecutionTest {
while (node.hasNext())
rows.add(node.next());
- Assert.assertArrayEquals(expRes, rows.toArray(EMPTY));
+ assertArrayEquals(expRes, rows.toArray(EMPTY));
}
/**
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanTableRowExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanTableRowExecutionTest.java
index f88e46d1a3c..003ea61d362 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanTableRowExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanTableRowExecutionTest.java
@@ -27,12 +27,12 @@ import org.apache.ignite.internal.processors.query.calcite.exec.TableRowIterable
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Execution test for ScanTableRowNode.
*/
-public class ScanTableRowExecutionTest extends AbstractExecutionTest {
+public class ScanTableRowExecutionTest extends AbstractExecutionParametrizedTest {
/** */
@Test
public void testScanTableRow() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateExecutionTest.java
index 2c556ac310a..0ac41eb21b3 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateExecutionTest.java
@@ -31,7 +31,7 @@ import org.apache.calcite.util.ImmutableIntList;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.MAP;
import static org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.AggregateType.REDUCE;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortedIndexSpoolExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortedIndexSpoolExecutionTest.java
index 706ddcfc5b2..21a32e79b48 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortedIndexSpoolExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortedIndexSpoolExecutionTest.java
@@ -35,21 +35,24 @@ import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.lang.GridTuple4;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T3;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import org.jetbrains.annotations.NotNull;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
/**
*
*/
@SuppressWarnings("TypeMayBeWeakened")
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
-public class SortedIndexSpoolExecutionTest extends AbstractExecutionTest {
+public class SortedIndexSpoolExecutionTest extends AbstractExecutionParametrizedTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolExecutionTest.java
index 6db0c94d4b2..461efb29406 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolExecutionTest.java
@@ -28,10 +28,12 @@ import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import org.jetbrains.annotations.NotNull;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static java.util.Collections.singletonList;
@@ -39,12 +41,13 @@ import static java.util.Collections.singletonList;
*
*/
@SuppressWarnings("TypeMayBeWeakened")
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
-public class TableSpoolExecutionTest extends AbstractExecutionTest {
+public class TableSpoolExecutionTest extends AbstractExecutionParametrizedTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TimeCalculationExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TimeCalculationExecutionTest.java
index e13b1a5a177..b978186e006 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TimeCalculationExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TimeCalculationExecutionTest.java
@@ -27,12 +27,12 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test execution/idle time calculation.
*/
-public class TimeCalculationExecutionTest extends AbstractExecutionTest {
+public class TimeCalculationExecutionTest extends AbstractExecutionParametrizedTest {
/** */
@Test
public void testTime() throws Exception {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UncollectExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UncollectExecutionTest.java
index a5835a82005..a5cf492e47e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UncollectExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UncollectExecutionTest.java
@@ -31,12 +31,12 @@ import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test for UNCOLLECT node execution.
*/
-public class UncollectExecutionTest extends AbstractExecutionTest {
+public class UncollectExecutionTest extends AbstractExecutionParametrizedTest {
/** */
@Test
public void testCollectionSizes() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/WindowExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/WindowExecutionTest.java
index bf409bde84b..6abff318bd8 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/WindowExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/WindowExecutionTest.java
@@ -50,16 +50,15 @@ import org.apache.ignite.internal.processors.query.calcite.trait.TraitUtils;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.rex.RexWindowBounds.CURRENT_ROW;
import static org.apache.calcite.rex.RexWindowBounds.UNBOUNDED_FOLLOWING;
import static org.apache.calcite.rex.RexWindowBounds.UNBOUNDED_PRECEDING;
/** */
-public class WindowExecutionTest extends AbstractExecutionTest {
+public class WindowExecutionTest extends AbstractExecutionParametrizedTest {
/** row_number() over (partition by {0}). */
@Test
public void testRowNumber() {
@@ -530,7 +529,7 @@ public class WindowExecutionTest extends AbstractExecutionTest {
Node<Object[]> input,
Object[][] expRes
) {
- Assert.assertEquals(streaming, WindowFunctions.streamable(grp));
+ assertEquals(streaming, WindowFunctions.streamable(grp));
WindowNode<Object[]> window = createWindowNode(ctx, grp, input);
@@ -623,7 +622,7 @@ public class WindowExecutionTest extends AbstractExecutionTest {
/**
* @throws Exception If failed.
*/
- @Before
+ @BeforeEach
@Override public void setup() throws Exception {
nodesCnt = 1;
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryBlockingTaskExecutorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryBlockingTaskExecutorTest.java
index 22d354b6180..dce280f3aa3 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryBlockingTaskExecutorTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryBlockingTaskExecutorTest.java
@@ -25,14 +25,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.pool.PoolProcessor;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/** */
-public class QueryBlockingTaskExecutorTest extends GridCommonAbstractTest {
+public class QueryBlockingTaskExecutorTest extends GridCommonAbstractWrapperTest {
/** Tests that tasks for different queries can be executed concurrently. */
@Test
public void testConcurrentTasks() throws Exception {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryTasksQueueTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryTasksQueueTest.java
index e132d4fd683..923cbee7d9a 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryTasksQueueTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/task/QueryTasksQueueTest.java
@@ -21,12 +21,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/** Tests QueryTasksQueue data structure. */
-public class QueryTasksQueueTest extends GridCommonAbstractTest {
+public class QueryTasksQueueTest extends GridCommonAbstractWrapperTest {
/** */
@Test
public void testQueryBlockingUnblocking() throws Exception {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java
index f45b4c574ac..a5a1f9dc0a4 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/tracker/MemoryTrackerTest.java
@@ -21,14 +21,14 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
*/
-public class MemoryTrackerTest extends GridCommonAbstractTest {
+public class MemoryTrackerTest extends GridCommonAbstractWrapperTest {
/** */
@Test
public void testBatchesAllocation() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
index e471b6c80e4..d5ebda2f85f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.processors.query.calcite.integration;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.rel.RelCollation;
import org.apache.calcite.rex.RexNode;
@@ -37,6 +39,7 @@ import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryContext;
import org.apache.ignite.internal.processors.query.QueryEngine;
import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionServiceImpl;
@@ -51,9 +54,10 @@ import org.apache.ignite.internal.thread.context.Scope;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
import static org.apache.ignite.internal.processors.authentication.AuthenticationProcessorSelfTest.authenticate;
import static org.apache.ignite.internal.processors.authentication.User.DFAULT_USER_NAME;
@@ -64,7 +68,7 @@ import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
/**
*
*/
-public class AbstractBasicIntegrationTest extends GridCommonAbstractTest {
+public class AbstractBasicIntegrationTest extends GridCommonAbstractWrapperTest {
/** */
protected static final Object[] NULL_RESULT = new Object[] { null };
@@ -75,6 +79,7 @@ public class AbstractBasicIntegrationTest extends GridCommonAbstractTest {
protected static IgniteEx client;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
cleanPersistenceDir();
@@ -88,6 +93,23 @@ public class AbstractBasicIntegrationTest extends GridCommonAbstractTest {
return true;
}
+ /** */
+ @AfterEach
+ public void runAfterTest() throws Exception {
+ AtomicBoolean afterTestFinished = new AtomicBoolean(false);
+
+ ScheduledExecutorService scheduler = scheduleThreadDumpOnAfterTestTimeOut(afterTestFinished);
+
+ try {
+ afterTest();
+ }
+ finally {
+ afterTestFinished.set(true);
+
+ scheduler.shutdownNow();
+ }
+ }
+
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
super.afterTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTransactionalTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTransactionalTest.java
index f35e2c29a01..6b5c5ee3153 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTransactionalTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTransactionalTest.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
@@ -35,23 +35,31 @@ import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.testframework.SupplierX;
import org.apache.ignite.transactions.Transaction;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
/** */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "sqlTxMode={0}")
+@MethodSource("parameters")
public abstract class AbstractBasicIntegrationTransactionalTest extends AbstractBasicIntegrationTest {
/** */
- @Parameterized.Parameter()
+ @Parameter(0)
public SqlTransactionMode sqlTxMode;
/** @return Test parameters. */
- @Parameterized.Parameters(name = "sqlTxMode={0}")
- public static Collection<?> parameters() {
- return Arrays.asList(SqlTransactionMode.values());
+ private static Collection<Arguments> parameters() {
+ Collection<Arguments> params = new ArrayList<>();
+ for (SqlTransactionMode mode : SqlTransactionMode.values()) {
+ params.add(Arguments.of(mode));
+ }
+ return params;
}
/** */
@@ -71,6 +79,7 @@ public abstract class AbstractBasicIntegrationTransactionalTest extends Abstract
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
if (currentMode != null && sqlTxMode == currentMode)
return;
@@ -84,7 +93,6 @@ public abstract class AbstractBasicIntegrationTransactionalTest extends Abstract
init();
}
-
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
clearTransaction();
@@ -93,6 +101,7 @@ public abstract class AbstractBasicIntegrationTransactionalTest extends Abstract
}
/** {@inheritDoc} */
+ @AfterAll
@Override protected void afterTestsStopped() throws Exception {
clearTransaction();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractDdlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractDdlIntegrationTest.java
index 2a4a6c5b280..d959207eb99 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractDdlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractDdlIntegrationTest.java
@@ -22,7 +22,9 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
-import org.junit.After;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
/** */
public class AbstractDdlIntegrationTest extends AbstractBasicIntegrationTest {
@@ -38,6 +40,7 @@ public class AbstractDdlIntegrationTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
@@ -45,6 +48,7 @@ public class AbstractDdlIntegrationTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @AfterAll
@Override protected void afterTestsStopped() throws Exception {
super.afterTestsStopped();
@@ -68,7 +72,7 @@ public class AbstractDdlIntegrationTest extends AbstractBasicIntegrationTest {
}
/** */
- @After
+ @AfterEach
public void cleanUp() {
client.destroyCaches(client.cacheNames());
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractMultiEngineIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractMultiEngineIntegrationTest.java
index 119bebfce4a..ce3756e5f83 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractMultiEngineIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractMultiEngineIntegrationTest.java
@@ -16,8 +16,6 @@
*/
package org.apache.ignite.internal.processors.query.calcite.integration;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
@@ -25,23 +23,21 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.ValueSource;
/** */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "Query engine={0}")
+@ValueSource(strings = {CalciteQueryEngineConfiguration.ENGINE_NAME, IndexingQueryEngineConfiguration.ENGINE_NAME})
public class AbstractMultiEngineIntegrationTest extends AbstractBasicIntegrationTest {
/** */
- @Parameterized.Parameter
- public String engine;
-
- /** */
- @Parameterized.Parameters(name = "Query engine={0}")
- public static Collection<?> params() {
- return Arrays.asList(CalciteQueryEngineConfiguration.ENGINE_NAME, IndexingQueryEngineConfiguration.ENGINE_NAME);
- }
+ @Parameter(0)
+ String engine;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
// No-op.
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AggregatesIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AggregatesIntegrationTest.java
index 7b0b9685e47..71f52e885d7 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AggregatesIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AggregatesIntegrationTest.java
@@ -29,8 +29,8 @@ import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
*
@@ -118,7 +118,7 @@ public class AggregatesIntegrationTest extends AbstractBasicIntegrationTransacti
}
/** */
- @Ignore("https://issues.apache.org/jira/browse/IGNITE-25765")
+ @Disabled("https://issues.apache.org/jira/browse/IGNITE-25765")
@Test
public void testArrayConcatAgg() {
sql("CREATE TABLE tarr(val INT, arrn INTEGER ARRAY, arrnn INTEGER ARRAY NOT NULL, arrn2 INTEGER ARRAY) WITH "
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AuthorizationIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AuthorizationIntegrationTest.java
index 677728b3089..18a415939b6 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AuthorizationIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AuthorizationIntegrationTest.java
@@ -46,10 +46,15 @@ import org.apache.ignite.plugin.security.SecurityException;
import org.apache.ignite.plugin.security.SecurityPermissionSet;
import org.apache.ignite.plugin.security.SecurityPermissionSetBuilder;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED;
import static org.apache.ignite.plugin.security.SecurityPermission.CACHE_CREATE;
@@ -63,7 +68,9 @@ import static org.apache.ignite.plugin.security.SecurityPermission.SQL_VIEW_DROP
/**
* Test authorization of different operations.
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "allowDdl = {0}")
+@MethodSource("parameters")
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class AuthorizationIntegrationTest extends AbstractSecurityTest {
/** */
private static final String LOGIN = "client";
@@ -87,15 +94,29 @@ public class AuthorizationIntegrationTest extends AbstractSecurityTest {
private static final AtomicInteger removeCnt = new AtomicInteger();
/** */
- @Parameterized.Parameter
+ @Parameter(0)
public boolean allowDdl;
/** */
- @Parameterized.Parameters(name = "allowDdl = {0}")
+ @MethodSource("parameters")
public static Iterable<Object> parameters() {
return Arrays.asList(false, true);
}
+ /** */
+ @BeforeAll
+ static void init() {
+ beforeFirstTest0();
+ }
+
+ /** {@inheritDoc} */
+ @AfterAll
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
return super.getConfiguration(igniteInstanceName)
@@ -112,6 +133,7 @@ public class AuthorizationIntegrationTest extends AbstractSecurityTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -147,6 +169,7 @@ public class AuthorizationIntegrationTest extends AbstractSecurityTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/BulkOperationDeadlockIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/BulkOperationDeadlockIntegrationTest.java
index 85abb91b5d8..d88f012c85a 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/BulkOperationDeadlockIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/BulkOperationDeadlockIntegrationTest.java
@@ -42,8 +42,9 @@ import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionIsolation;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -74,6 +75,7 @@ public class BulkOperationDeadlockIntegrationTest extends AbstractBasicIntegrati
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -122,7 +124,7 @@ public class BulkOperationDeadlockIntegrationTest extends AbstractBasicIntegrati
}
/** Concurrent updates lock rows produced by an unordered scan without deadlocks. */
- @Ignore("IGNITE-28958 Prevent deadlocks in concurrent bulk operations with different key orders")
+ @Disabled("IGNITE-28958 Prevent deadlocks in concurrent bulk operations with different key orders")
@Test
public void testUpdateWithWhereDoesNotDeadlock() {
runConcurrentBulkOperation(
@@ -139,7 +141,7 @@ public class BulkOperationDeadlockIntegrationTest extends AbstractBasicIntegrati
}
/** Concurrent putAll operations lock keys in opposite map iteration orders without deadlocks. */
- @Ignore("IGNITE-28958 Prevent deadlocks in concurrent bulk operations with different key orders")
+ @Disabled("IGNITE-28958 Prevent deadlocks in concurrent bulk operations with different key orders")
@Test
public void testPutAllWithOppositeKeyOrderDoesNotDeadlock() {
runConcurrentBulkOperation(
@@ -158,7 +160,7 @@ public class BulkOperationDeadlockIntegrationTest extends AbstractBasicIntegrati
}
/** Concurrent getAll operations lock keys in opposite set iteration orders without deadlocks. */
- @Ignore("IGNITE-28958 Prevent deadlocks in concurrent bulk operations with different key orders")
+ @Disabled("IGNITE-28958 Prevent deadlocks in concurrent bulk operations with different key orders")
@Test
public void testGetAllWithOppositeKeyOrderDoesNotDeadlock() {
runConcurrentBulkOperation(
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheStoreTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheStoreTest.java
index 948a34f9f35..0e48feb29dc 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheStoreTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheStoreTest.java
@@ -18,47 +18,71 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
import java.io.Serializable;
-import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.stream.Stream;
import javax.cache.Cache;
import javax.cache.configuration.FactoryBuilder;
import javax.cache.integration.CacheWriterException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
-import org.junit.runners.Parameterized;
-
-import static java.util.Arrays.asList;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.testframework.GridTestUtils.cartesianProduct;
/** */
-public class CacheStoreTest extends AbstractMultiEngineIntegrationTest {
+@ParameterizedClass(name = "Engine={0}, atomicityMode={1}, cacheMode={2}, backups={3}, loadPreviousValue={4}")
+@MethodSource("parameters")
+public class CacheStoreTest extends AbstractBasicIntegrationTest {
+ /** */
+ @Parameter(0)
+ String engine;
+
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public CacheAtomicityMode atomicityMode;
/** */
- @Parameterized.Parameter(2)
+ @Parameter(2)
public CacheMode cacheMode;
/** */
- @Parameterized.Parameter(3)
+ @Parameter(3)
public int backups;
/** */
- @Parameterized.Parameter(4)
+ @Parameter(4)
public boolean loadPreviousValue;
+ /** {@inheritDoc} */
+ @BeforeAll
+ @Override protected void beforeTestsStarted() throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ writeThroughEntries.clear();
+ readThroughEntries.clear();
+ }
+
/** */
private static final List<Object> writeThroughEntries = new CopyOnWriteArrayList<>();
@@ -66,20 +90,22 @@ public class CacheStoreTest extends AbstractMultiEngineIntegrationTest {
private static final List<Object> readThroughEntries = new CopyOnWriteArrayList<>();
/** */
- @Parameterized.Parameters(name = "Engine={0}, atomicityMode={1}, cacheMode={2}, backups={3}, loadPreviousValue={4}")
- public static Collection<?> params() {
+ private static Stream<Arguments> parameters() {
return cartesianProduct(
- asList(CalciteQueryEngineConfiguration.ENGINE_NAME, IndexingQueryEngineConfiguration.ENGINE_NAME),
- asList(CacheAtomicityMode.ATOMIC, CacheAtomicityMode.TRANSACTIONAL),
- asList(CacheMode.PARTITIONED, CacheMode.REPLICATED),
- asList(0, 1),
- asList(false, true)
- );
+ List.of(CalciteQueryEngineConfiguration.ENGINE_NAME, IndexingQueryEngineConfiguration.ENGINE_NAME),
+ List.of(CacheAtomicityMode.ATOMIC, CacheAtomicityMode.TRANSACTIONAL),
+ List.of(CacheMode.PARTITIONED, CacheMode.REPLICATED),
+ List.of(0, 1),
+ List.of(false, true)
+ ).stream().map(Arguments::of);
}
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName)
+ .setSqlConfiguration(new SqlConfiguration()
+ .setQueryEnginesConfiguration(engine.equals(CalciteQueryEngineConfiguration.ENGINE_NAME) ?
+ new CalciteQueryEngineConfiguration() : new IndexingQueryEngineConfiguration()));
cfg.setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
.setBackups(backups)
@@ -101,14 +127,6 @@ public class CacheStoreTest extends AbstractMultiEngineIntegrationTest {
return cfg;
}
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
-
- writeThroughEntries.clear();
- readThroughEntries.clear();
- }
-
/** */
@Test
public void testCacheStoreOnDML() throws Exception {
@@ -150,6 +168,12 @@ public class CacheStoreTest extends AbstractMultiEngineIntegrationTest {
checkReadThrough(1002, 1003, 1004);
}
+ /** */
+ @Override protected List<List<?>> sql(IgniteEx ignite, String sql, Object... params) {
+ return ignite.context().query().querySqlFields(new SqlFieldsQuery(sql).setArgs(params), true)
+ .getAll();
+ }
+
/** */
private void checkWriteThrough(Object... keys) {
assertEqualsCollectionsIgnoringOrder(F.asList(keys), writeThroughEntries);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java
index 94342b8d588..828157f2899 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
-import java.util.Collection;
import java.util.List;
import javax.cache.Cache;
import org.apache.ignite.IgniteCache;
@@ -32,13 +31,15 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.ValueSource;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -46,19 +47,15 @@ import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
/** Cache interceptor related tests. */
-@RunWith(Parameterized.class)
-public class CacheWithInterceptorIntegrationTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "keepBinary={0}")
+@ValueSource(booleans = {true, false})
+public class CacheWithInterceptorIntegrationTest extends GridCommonAbstractWrapperTest {
/** Keep binary mode. */
- @Parameterized.Parameter(0)
+ @Parameter(0)
public boolean keepBinary;
- /** */
- @Parameterized.Parameters(name = "keepBinary={0}")
- public static Collection<?> parameters() {
- return List.of(true, false);
- }
-
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteBasicSecondaryIndexIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteBasicSecondaryIndexIntegrationTest.java
index 396eb28e8dc..e6199ccf0df 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteBasicSecondaryIndexIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteBasicSecondaryIndexIntegrationTest.java
@@ -29,9 +29,8 @@ import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessorTest;
import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Ignore;
-import org.junit.Test;
-
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsAnyProject;
@@ -213,6 +212,7 @@ public class CalciteBasicSecondaryIndexIntegrationTest extends AbstractBasicInte
}
/** {@inheritDoc} */
+ @AfterAll
@Override protected void afterTestsStopped() {
stopAllGrids();
}
@@ -920,16 +920,14 @@ public class CalciteBasicSecondaryIndexIntegrationTest extends AbstractBasicInte
// ===== various complex conditions =====
/** */
- @Ignore("TODO")
@Test
public void testOrderByKey() {
- assertQuery("SELECT id, name, depId, age FROM Developer ORDER BY _key")
- .matches(containsTableScan("PUBLIC", "DEVELOPER"))
- .matches(not(containsSubPlan("IgniteSort")))
- .returns(1, "Mozart", 3, "Vienna", 33)
- .returns(2, "Beethoven", 2, "Vienna", 44)
- .returns(3, "Bach", 1, "Leipzig", 55)
- .returns(4, "Strauss", 2, "Munich", 66)
+ assertQuery("SELECT id, name, depId, age FROM Developer WHERE id<=4 ORDER BY _key")
+ .matches(containsIndexScan("PUBLIC", "DEVELOPER"))
+ .returns(1, "Mozart", 3, 33)
+ .returns(2, "Beethoven", 2, 44)
+ .returns(3, "Bach", 1, 55)
+ .returns(4, "Strauss", 2, 66)
.ordered()
.check();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteErrorHandlilngIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteErrorHandlilngIntegrationTest.java
index 764fb1813bb..a5ce418db2e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteErrorHandlilngIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteErrorHandlilngIntegrationTest.java
@@ -22,7 +22,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
-
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.query.SqlFieldsQuery;
@@ -39,24 +38,26 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.message.QueryStartRequest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.After;
-import org.junit.Test;
-
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.internal.processors.query.calcite.exec.LogicalRelImplementor.CNLJ_NOT_SUPPORTED_JOIN_ASSERTION_MSG;
/** */
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "false")
-public class CalciteErrorHandlilngIntegrationTest extends GridCommonAbstractTest {
+public class CalciteErrorHandlilngIntegrationTest extends GridCommonAbstractWrapperTest {
/** */
- @After
+ @AfterEach
public void cleanUp() {
stopAllGrids();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalcitePlanningDumpTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalcitePlanningDumpTest.java
index 409dc4c3893..9ce67e4e563 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalcitePlanningDumpTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalcitePlanningDumpTest.java
@@ -19,14 +19,16 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
import java.util.stream.Stream;
-
import org.apache.calcite.plan.RelOptPlanner;
import org.apache.calcite.rel.RelCollation;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteTable;
import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Test;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.IgniteCommonsSystemProperties.getLong;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.IGNITE_CALCITE_PLANNER_TIMEOUT;
@@ -36,10 +38,19 @@ import static org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCaus
* This test assumes no Calcite classes are loaded in the current JVM before CalciteQueryProcessor.
* Violating this invariant may cause the test to fail due to premature Calcite initialization.
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = IGNITE_CALCITE_PLANNER_TIMEOUT, value = "1000")
public class CalcitePlanningDumpTest extends AbstractBasicIntegrationTest {
/** */
- private static final long PLANNER_TIMEOUT = getLong(IGNITE_CALCITE_PLANNER_TIMEOUT, 0);
+ private static long plannerTimeout;
+
+ /** {@inheritDoc} */
+ @BeforeAll
+ @Override protected void beforeTestsStarted() throws Exception {
+ plannerTimeout = getLong(IGNITE_CALCITE_PLANNER_TIMEOUT, 0);
+
+ super.beforeTestsStarted();
+ }
/** */
@Test
@@ -51,7 +62,7 @@ public class CalcitePlanningDumpTest extends AbstractBasicIntegrationTest {
tbl.addIndex(new DelegatingIgniteIndex(tbl.getIndex(QueryUtils.PRIMARY_KEY_INDEX)) {
@Override public RelCollation collation() {
- doSleep(PLANNER_TIMEOUT);
+ doSleep(plannerTimeout);
return delegate.collation();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CollectIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CollectIntegrationTest.java
index 726a3453e1b..ecf49b67c4e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CollectIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CollectIntegrationTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
import org.apache.ignite.internal.processors.query.calcite.exec.rel.AbstractNode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Integration test for collect node.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java
index c07981e3c8d..69e03041d0f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java
@@ -21,7 +21,7 @@ import java.sql.Date;
import java.time.Instant;
import java.util.UUID;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests correlated queries.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DataTypesTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DataTypesTest.java
index 5922949257b..b26572cdec8 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DataTypesTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DataTypesTest.java
@@ -37,11 +37,11 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.IgniteSqlFun
import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.SupplierX;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.FRAMEWORK_CONFIG;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
/**
* Test SQL data types.
@@ -699,7 +699,7 @@ public class DataTypesTest extends AbstractBasicIntegrationTransactionalTest {
}
/** */
- @Ignore("https://issues.apache.org/jira/browse/IGNITE-25749")
+ @Disabled("https://issues.apache.org/jira/browse/IGNITE-25749")
@Test
public void testCharLiteralsInUnion() {
assumeTrue(sqlTxMode == SqlTransactionMode.NONE);
@@ -1127,6 +1127,6 @@ public class DataTypesTest extends AbstractBasicIntegrationTransactionalTest {
/** */
private void assumeNoTransactions() {
- assumeTrue("Test use queries that doesn't touch any data. Skip for tx modes", sqlTxMode == SqlTransactionMode.NONE);
+ assumeTrue(sqlTxMode == SqlTransactionMode.NONE, "Test use queries that doesn't touch any data. Skip for tx modes");
}
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DateTimeTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DateTimeTest.java
index a2d23d8b18a..efc4c70a41f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DateTimeTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DateTimeTest.java
@@ -27,8 +27,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static java.util.Collections.singletonList;
/** */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java
index 9249c495d33..4b2bfed41df 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java
@@ -21,7 +21,7 @@ import java.math.BigDecimal;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/** */
public class DistributedJoinIntegrationTest extends AbstractBasicIntegrationTransactionalTest {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DynamicParametersIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DynamicParametersIntegrationTest.java
index 8a130f5a2e1..9728bee3d25 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DynamicParametersIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DynamicParametersIntegrationTest.java
@@ -33,7 +33,8 @@ import org.apache.ignite.internal.processors.query.calcite.exec.rel.SortNode;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Dynamic parameters types inference test.
@@ -58,6 +59,7 @@ public class DynamicParametersIntegrationTest extends AbstractBasicIntegrationTe
}
/** {@inheritDoc} */
+ @BeforeEach
@Override public void beforeTest() throws Exception {
super.beforeTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ExpiredEntriesIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ExpiredEntriesIntegrationTest.java
index 625ed03d4b2..3ad02a54636 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ExpiredEntriesIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ExpiredEntriesIntegrationTest.java
@@ -27,8 +27,8 @@ import org.apache.ignite.internal.metric.IoStatisticsHolder;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
-
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsIndexScan;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsSubPlan;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsTableScan;
@@ -38,6 +38,7 @@ import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.c
*/
public class ExpiredEntriesIntegrationTest extends AbstractBasicIntegrationTest {
/** */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
CacheConfiguration<Integer, Developer> cacheCfg = new CacheConfiguration<Integer, Developer>()
.setIndexedTypes(Integer.class, Developer.class)
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/FunctionsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/FunctionsTest.java
index 2e52c5a3479..d022707002c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/FunctionsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/FunctionsTest.java
@@ -31,7 +31,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test Ignite SQL functions.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/HashSpoolIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/HashSpoolIntegrationTest.java
index f0313935fa0..e9a523f0b6d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/HashSpoolIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/HashSpoolIntegrationTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Hash spool test.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java
index fd29b491d71..e5827a7c84e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexDdlIntegrationTest.java
@@ -28,7 +28,8 @@ import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/** */
public class IndexDdlIntegrationTest extends AbstractDdlIntegrationTest {
@@ -36,6 +37,7 @@ public class IndexDdlIntegrationTest extends AbstractDdlIntegrationTest {
private static final String CACHE_NAME = "my_cache";
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
sql("create table my_table(id int, val_int int, val_str varchar) with cache_name=\"" + CACHE_NAME + "\"");
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexMultiRangeScanIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexMultiRangeScanIntegrationTest.java
index a4239b8f33a..8cfa51e9801 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexMultiRangeScanIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexMultiRangeScanIntegrationTest.java
@@ -16,38 +16,35 @@
*/
package org.apache.ignite.internal.processors.query.calcite.integration;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
+import java.util.stream.Stream;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.testframework.GridTestUtils;
import org.hamcrest.CoreMatchers;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests index multi-range scans (with SEARCH/SARG operator or with dynamic parameters).
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "sqlTxMode={0}, dynamicParams={1}")
+@MethodSource("parameters")
public class IndexMultiRangeScanIntegrationTest extends AbstractBasicIntegrationTransactionalTest {
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public boolean dynamicParams;
- /** @return Test parameters. */
- @Parameterized.Parameters(name = "sqlTxMode={0},dynamicParams={1}")
- public static Collection<?> parameters() {
- List<Object[]> params = new ArrayList<>();
-
- for (boolean dynamicParams : new boolean[]{true, false}) {
- for (SqlTransactionMode sqlTxMode : SqlTransactionMode.values()) {
- params.add(new Object[]{sqlTxMode, dynamicParams});
- }
- }
-
- return params;
+ /** */
+ private static Stream<Arguments> parameters() {
+ return GridTestUtils.cartesianProduct(
+ Arrays.stream(SqlTransactionMode.values()).toList(),
+ List.of(true, false)
+ ).stream().map(Arguments::of);
}
/** {@inheritDoc} */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexRebuildIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexRebuildIntegrationTest.java
index cc785af571e..5ad8a80f973 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexRebuildIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexRebuildIntegrationTest.java
@@ -39,7 +39,9 @@ import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisito
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.testframework.GridTestUtils;
import org.hamcrest.CoreMatchers;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Test index rebuild.
@@ -66,6 +68,7 @@ public class IndexRebuildIntegrationTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
initLatch = null;
startLatch = null;
@@ -80,6 +83,7 @@ public class IndexRebuildIntegrationTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
cleanPersistenceDir();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanMultiNodeIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanMultiNodeIntegrationTest.java
index f890fd2d01c..4116e524110 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanMultiNodeIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanMultiNodeIntegrationTest.java
@@ -23,7 +23,7 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Multi node index scan test.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanlIntegrationTest.java
index df79c0490c0..afa3742ef48 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexScanlIntegrationTest.java
@@ -45,7 +45,7 @@ import org.apache.ignite.internal.util.typedef.G;
import org.hamcrest.CoreMatchers;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Index scan test.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexSpoolIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexSpoolIntegrationTest.java
index e0db2f517f2..736cb5b7f1d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexSpoolIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IndexSpoolIntegrationTest.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.QueryEntity;
@@ -31,49 +30,54 @@ import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.query.QueryEngine;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static java.util.Collections.singletonList;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Index spool test.
*/
-@RunWith(Parameterized.class)
-public class IndexSpoolIntegrationTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "Rows: {0}")
+@MethodSource("testData")
+public class IndexSpoolIntegrationTest extends GridCommonAbstractWrapperTest {
/** Rows. */
private static final int[] ROWS = {1, 10, 512, 513, 2000};
/** */
- @Parameterized.Parameter(0)
+ @Parameter(0)
public int rows;
/**
* @return List of versions pairs to test.
*/
- @Parameterized.Parameters(name = "Rows: {0}")
- public static Collection<Object[]> testData() {
- List<Object[]> params = new ArrayList<>();
+ private static Collection<Arguments> testData() {
+ List<Arguments> params = new ArrayList<>();
for (int rs : ROWS)
- params.add(new Object[]{rs});
+ params.add(Arguments.of(rs));
return params;
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
startGrids(2);
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
fillCache(grid(0).cache("TEST0"), rows);
fillCache(grid(0).cache("TEST1"), rows);
@@ -82,6 +86,7 @@ public class IndexSpoolIntegrationTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
grid(0).cache("TEST0").clear();
grid(0).cache("TEST1").clear();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IntervalTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IntervalTest.java
index 63b2e816dfd..30b944afcfa 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IntervalTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/IntervalTest.java
@@ -23,7 +23,7 @@ import java.sql.Timestamp;
import java.time.Duration;
import java.time.Period;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test SQL INTERVAL data types.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/JoinIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/JoinIntegrationTest.java
index ee797b3137e..93eec4293a3 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/JoinIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/JoinIntegrationTest.java
@@ -20,30 +20,34 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
-import org.junit.Assume;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
/** */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "sqlTxMode={0}, joinType={1}")
+@MethodSource("parameters")
public class JoinIntegrationTest extends AbstractBasicIntegrationTransactionalTest {
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public JoinType joinType;
/** */
- @Parameterized.Parameters(name = "sqlTxMode={0},joinType={1}")
- public static List<Object[]> params() {
- List<Object[]> params = new ArrayList<>();
+ private static Stream<Arguments> parameters() {
+ List<Arguments> params = new ArrayList<>();
for (SqlTransactionMode sqlTxMode : SqlTransactionMode.values()) {
for (JoinType jt : JoinType.values())
- params.add(new Object[] {sqlTxMode, jt});
+ params.add(Arguments.of(sqlTxMode, jt));
}
- return params;
+ return params.stream();
}
/** {@inheritDoc} */
@@ -688,7 +692,7 @@ public class JoinIntegrationTest extends AbstractBasicIntegrationTransactionalTe
*/
@Test
public void testRightJoin() {
- Assume.assumeTrue(joinType != JoinType.CORRELATED);
+ assumeTrue(joinType != JoinType.CORRELATED);
assertQuery("" +
"select t1.c1 c11, t1.c2 c12, t2.c1 c21, t2.c2 c22, t2.c3 c23 " +
@@ -1035,7 +1039,7 @@ public class JoinIntegrationTest extends AbstractBasicIntegrationTransactionalTe
*/
@Test
public void testFullJoin() {
- Assume.assumeTrue(joinType != JoinType.CORRELATED);
+ assumeTrue(joinType != JoinType.CORRELATED);
assertQuery("" +
"select t1.c1 c11, t1.c2 c12, t1.c3 c13, t2.c1 c21, t2.c2 c22, t2.c3 c23 " +
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java
index 6eaf7b11687..d996c08f13c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeepBinaryIntegrationTest.java
@@ -28,7 +28,7 @@ import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.SupplierX;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test "keep binary" in cache queries.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeyClassChangeIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeyClassChangeIntegrationTest.java
index 6cefef53b03..fb421ef654e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeyClassChangeIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KeyClassChangeIntegrationTest.java
@@ -37,7 +37,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.failure.TestFailureHandler;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/** */
public class KeyClassChangeIntegrationTest extends AbstractMultiEngineIntegrationTest {
@@ -56,9 +57,10 @@ public class KeyClassChangeIntegrationTest extends AbstractMultiEngineIntegratio
/** */
private boolean pds;
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
+ /** */
+ @BeforeEach
+ void setup() throws Exception {
+ beforeTest();
failureHnd = new TestFailureHandler(true);
validateTypes = false;
@@ -70,8 +72,6 @@ public class KeyClassChangeIntegrationTest extends AbstractMultiEngineIntegratio
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- super.afterTest();
-
stopAllGrids();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillCommandDdlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillCommandDdlIntegrationTest.java
index 6ddd58be28d..25945d09f74 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillCommandDdlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillCommandDdlIntegrationTest.java
@@ -46,7 +46,8 @@ import org.apache.ignite.spi.systemview.view.ContinuousQueryView;
import org.apache.ignite.spi.systemview.view.ScanQueryView;
import org.apache.ignite.spi.systemview.view.SystemView;
import org.apache.ignite.transactions.Transaction;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.managers.systemview.ScanQuerySystemView.SCAN_QRY_SYS_VIEW;
import static org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.CQ_SYS_VIEW;
@@ -69,6 +70,7 @@ public class KillCommandDdlIntegrationTest extends AbstractDdlIntegrationTest {
public static final int TIMEOUT = 10_000;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillQueryCommandDdlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillQueryCommandDdlIntegrationTest.java
index 1d03fdf9aae..6de9766167d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillQueryCommandDdlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/KillQueryCommandDdlIntegrationTest.java
@@ -43,32 +43,34 @@ import org.apache.ignite.spi.systemview.view.SystemView;
import org.apache.ignite.testframework.GridTestUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.internal.processors.query.running.RunningQueryManager.SQL_QRY_VIEW;
/**
* Tests `KILL QUERY` command.
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "isAsync={0}, cancelOnClient={1}")
+@MethodSource("parameters")
public class KillQueryCommandDdlIntegrationTest extends AbstractDdlIntegrationTest {
/** Operations timeout. */
public static final int TIMEOUT = 10_000;
/** If {@code true}, cancel asynchronously. */
- @Parameterized.Parameter(0)
+ @Parameter(0)
public boolean isAsync;
/** If {@code true}, cancel on client(initiator), otherwise on server. */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public boolean cancelOnClient;
/** @return Test parameters. */
- @Parameterized.Parameters(name = "isAsync={0},cancelOnClient={1}")
- public static Collection<?> parameters() {
- return Stream.of(true, false).flatMap(p -> Stream.of(new Object[] {p, true}, new Object[] {p, false}))
+ @MethodSource("parameters")
+ private static Collection<Arguments> parameters() {
+ return Stream.of(true, false).flatMap(p -> Stream.of(Arguments.of(p, true), Arguments.of(p, false)))
.collect(Collectors.toList());
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LimitOffsetIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LimitOffsetIntegrationTest.java
index ac0f38e46cc..54fd409ddae 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LimitOffsetIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LimitOffsetIntegrationTest.java
@@ -32,7 +32,7 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static java.util.Collections.singletonList;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java
index 1b1f5bf7d52..f28f2b268c3 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalDateTimeSupportTest.java
@@ -37,9 +37,11 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.internal.util.typedef.G;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static java.util.Collections.singletonList;
import static org.apache.ignite.internal.cache.query.index.sorted.inline.types.DateValueUtils.convertToSqlDate;
@@ -47,62 +49,61 @@ import static org.apache.ignite.internal.cache.query.index.sorted.inline.types.D
import static org.apache.ignite.internal.cache.query.index.sorted.inline.types.DateValueUtils.convertToTimestamp;
/** */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "sqlTxMode={0}, isValidationEnabled={1}, sqlType={2}, columnCls={3}, testObjCls={4}, beforeGregorian={6}")
+@MethodSource("parameters")
public class LocalDateTimeSupportTest extends AbstractBasicIntegrationTransactionalTest {
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public boolean isValidationEnabled;
/** */
- @Parameterized.Parameter(2)
+ @Parameter(2)
public String sqlType;
/** */
- @Parameterized.Parameter(3)
+ @Parameter(3)
public Class<?> colType;
/** */
- @Parameterized.Parameter(4)
+ @Parameter(4)
public Class<?> objType;
/** */
- @Parameterized.Parameter(5)
+ @Parameter(5)
public Function<Object, Object> sqlTypeConverter;
/** */
- @Parameterized.Parameter(6)
+ @Parameter(6)
public boolean isOldDate;
/** */
- @Parameterized.Parameters(
- name = "sqlTxMode={0}, isValidationEnabled={1}, sqlType={2}, columnCls={3}, testObjCls={4}, beforeGregorian={6}")
- public static Collection<Object[]> parameters() {
- Collection<Object[]> params = new ArrayList<>();
+ private static Collection<Arguments> parameters() {
+ Collection<Arguments> params = new ArrayList<>();
for (SqlTransactionMode sqlTxmode : SqlTransactionMode.values()) {
for (boolean isOldDate: Arrays.asList(true, false)) {
for (boolean isV : Arrays.asList(true, false)) {
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, "TIMESTAMP", null, LocalDateTime.class, f(ts -> convertToTimestamp((LocalDateTime)ts)), isOldDate
- });
- params.add(new Object[] {
+ ));
+ params.add(Arguments.of(
sqlTxmode, isV, "TIMESTAMP", null, Date.class, f(ts -> new Timestamp(((Date)ts).getTime())), isOldDate
- });
- params.add(new Object[] {
+ ));
+ params.add(Arguments.of(
sqlTxmode, isV, "TIMESTAMP", null, java.sql.Date.class, f(ts -> new Timestamp(((Date)ts).getTime())), isOldDate
- });
+ ));
for (Class<?> testObjCls : Arrays.asList(Timestamp.class, LocalDateTime.class, Date.class, java.sql.Date.class)) {
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, null, Timestamp.class, testObjCls, f(ts -> {
if (ts instanceof LocalDateTime)
return convertToTimestamp((LocalDateTime)ts);
return ts;
}),
isOldDate
- });
+ ));
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, null, Date.class, testObjCls, f(ts -> {
if (testObjCls == LocalDateTime.class)
return new Date(convertToTimestamp((LocalDateTime)ts).getTime());
@@ -111,9 +112,9 @@ public class LocalDateTimeSupportTest extends AbstractBasicIntegrationTransactio
return ts;
}),
isOldDate
- });
+ ));
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, null, LocalDateTime.class, testObjCls, f(ts -> {
if (testObjCls == Timestamp.class)
return ((Timestamp)ts).toLocalDateTime();
@@ -125,55 +126,55 @@ public class LocalDateTimeSupportTest extends AbstractBasicIntegrationTransactio
return ts;
}),
isOldDate
- });
+ ));
}
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, "DATE", null, LocalDate.class, f(d -> convertToSqlDate((LocalDate)d)), isOldDate
- });
+ ));
for (Class<?> testObjCls : Arrays.asList(LocalDate.class, java.sql.Date.class)) {
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, null, java.sql.Date.class, testObjCls, f(ts -> {
if (testObjCls == LocalDate.class)
return convertToSqlDate((LocalDate)ts);
return ts;
}),
isOldDate
- });
+ ));
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, null, LocalDate.class, testObjCls, f(ts -> {
if (testObjCls == java.sql.Date.class)
return ((java.sql.Date)ts).toLocalDate();
return ts;
}),
isOldDate
- });
+ ));
}
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, "TIME", null, LocalTime.class, f(t -> convertToSqlTime((LocalTime)t)), isOldDate
- });
+ ));
for (Class<?> testObjCls : Arrays.asList(LocalTime.class, java.sql.Time.class)) {
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, null, java.sql.Time.class, testObjCls, f(ts -> {
if (testObjCls == LocalTime.class)
return convertToSqlTime((LocalTime)ts);
return ts;
}),
isOldDate
- });
+ ));
- params.add(new Object[] {
+ params.add(Arguments.of(
sqlTxmode, isV, null, LocalTime.class, testObjCls, f(ts -> {
if (testObjCls == java.sql.Time.class)
return ((java.sql.Time)ts).toLocalTime();
return ts;
}),
isOldDate
- });
+ ));
}
}
}
@@ -195,10 +196,15 @@ public class LocalDateTimeSupportTest extends AbstractBasicIntegrationTransactio
@Override protected void afterTest() throws Exception {
super.afterTest();
- for (Ignite ig: G.allGrids()) {
- IgniteCacheObjectProcessor objProc = ((IgniteEx)ig).context().cacheObjects();
+ try {
+ for (Ignite ig : G.allGrids()) {
+ IgniteCacheObjectProcessor objProc = ((IgniteEx)ig).context().cacheObjects();
- objProc.removeType(objProc.typeId(Data.class.getName()));
+ objProc.removeType(objProc.typeId(Data.class.getName()));
+ }
+ }
+ catch (Exception ignore) {
+ // No op.
}
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalQueryIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalQueryIntegrationTest.java
index 9b4ece05519..cdead908e90 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalQueryIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LocalQueryIntegrationTest.java
@@ -27,7 +27,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.query.QueryContext;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/** */
public class LocalQueryIntegrationTest extends AbstractBasicIntegrationTest {
@@ -58,6 +59,7 @@ public class LocalQueryIntegrationTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java
index ca271177986..b0b670e7c4b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MemoryQuotasIntegrationTest.java
@@ -29,7 +29,8 @@ import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.transactions.Transaction;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
@@ -57,9 +58,10 @@ public class MemoryQuotasIntegrationTest extends AbstractBasicIntegrationTest {
.setTransactionConfiguration(new TransactionConfiguration().setTxAwareQueriesEnabled(true));
}
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
+ /** */
+ @BeforeEach
+ void setup() throws Exception {
+ beforeTest();
sql("CREATE TABLE tbl (id INT, b VARBINARY) WITH TEMPLATE=REPLICATED, ATOMICITY=TRANSACTIONAL");
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MetadataIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MetadataIntegrationTest.java
index eea66fe70e8..3ff581c0e39 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MetadataIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MetadataIntegrationTest.java
@@ -22,8 +22,7 @@ import java.util.Collections;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Stream.generate;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MultiDcQueryMappingTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MultiDcQueryMappingTest.java
index dd6169df11b..9e0aaf067f1 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MultiDcQueryMappingTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/MultiDcQueryMappingTest.java
@@ -39,7 +39,8 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/** */
public class MultiDcQueryMappingTest extends AbstractBasicIntegrationTest {
@@ -125,6 +126,7 @@ public class MultiDcQueryMappingTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
// No-op.
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/OperatorsExtensionIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/OperatorsExtensionIntegrationTest.java
index 004580b915c..db261920fe5 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/OperatorsExtensionIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/OperatorsExtensionIntegrationTest.java
@@ -78,7 +78,7 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
import org.apache.ignite.plugin.AbstractTestPluginProvider;
import org.apache.ignite.plugin.PluginContext;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests SQL engine extension with plugin.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionPruneTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionPruneTest.java
index ac6fc2c47ad..4b363c76abc 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionPruneTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionPruneTest.java
@@ -47,7 +47,8 @@ import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/** */
public class PartitionPruneTest extends AbstractBasicIntegrationTest {
@@ -115,6 +116,7 @@ public class PartitionPruneTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
@@ -317,7 +319,6 @@ public class PartitionPruneTest extends AbstractBasicIntegrationTest {
});
}
-
/** */
@Test
public void testSelectOr() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionsReservationIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionsReservationIntegrationTest.java
index cf4314a439d..03c974af6c0 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionsReservationIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/PartitionsReservationIntegrationTest.java
@@ -34,7 +34,9 @@ import org.apache.ignite.internal.processors.query.calcite.rel.IgniteIndexCount;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteCacheTable;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests partition reservation/releasing for queries over unstable topology.
@@ -47,12 +49,14 @@ public class PartitionsReservationIntegrationTest extends AbstractBasicIntegrati
private static final int KEYS = PARTS * 100_000;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
// No-op. Don't start any grids.
}
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
+ /** */
+ @BeforeEach
+ void setup() throws Exception {
startGrids(2);
client = startClientGrid();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java
index c31b287caa8..a20dca19fa5 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java
@@ -19,14 +19,17 @@ package org.apache.ignite.internal.processors.query.calcite.integration;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Test;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR;
/**
* Integration test with common queries for query blocking task executor instead of striped task executor.
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR, value = "true")
public class QueryBlockingTaskExecutorIntegrationTest extends AbstractBasicIntegrationTransactionalTest {
/** */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java
index 435f2b9b132..272fb24019d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryEngineConfigurationIntegrationTest.java
@@ -36,12 +36,12 @@ import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
import org.apache.ignite.internal.processors.query.NoOpQueryEngine;
import org.apache.ignite.internal.processors.query.QueryEngine;
import org.apache.ignite.internal.processors.query.QueryEngineConfigurationEx;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/** */
-public class QueryEngineConfigurationIntegrationTest extends GridCommonAbstractTest {
+public class QueryEngineConfigurationIntegrationTest extends GridCommonAbstractWrapperTest {
/** */
private static final String jdbcUrl = "jdbc:ignite:thin://127.0.0.1";
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryMetadataIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryMetadataIntegrationTest.java
index 5947b3cc8db..02bc2dd5d0b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryMetadataIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryMetadataIntegrationTest.java
@@ -31,9 +31,8 @@ import org.apache.ignite.internal.processors.query.QueryEngine;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.util.typedef.T2;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-
import static org.apache.calcite.rel.type.RelDataType.PRECISION_NOT_SPECIFIED;
import static org.apache.calcite.rel.type.RelDataType.SCALE_NOT_SPECIFIED;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryWithPartitionsIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryWithPartitionsIntegrationTest.java
index e5e68334974..b42331cb430 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryWithPartitionsIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryWithPartitionsIntegrationTest.java
@@ -35,12 +35,17 @@ import org.apache.ignite.internal.processors.query.QueryContext;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/** */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "local = {0}, partSz = {1}")
+@MethodSource("parameters")
public class QueryWithPartitionsIntegrationTest extends AbstractBasicIntegrationTest {
/** */
private static final int ENTRIES_COUNT = 10000;
@@ -49,23 +54,24 @@ public class QueryWithPartitionsIntegrationTest extends AbstractBasicIntegration
private volatile int[] parts;
/** */
- @Parameterized.Parameter()
+ @Parameter(0)
public boolean local;
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public int partSz;
/** */
- @Parameterized.Parameters(name = "local = {0}, partSz = {1}")
- public static List<Object[]> parameters() {
+ @MethodSource("parameters")
+ private static List<Arguments> parameters() {
return Stream.of(true, false)
.flatMap(isLocal -> Stream.of(1, 2, 5, 10, 20)
- .map(i -> new Object[]{isLocal, i}))
+ .map(i -> Arguments.of(isLocal, i)))
.collect(Collectors.toList());
}
/** {@inheritDoc} */
+ @BeforeEach
@Override public void beforeTest() throws Exception {
super.beforeTest();
@@ -104,6 +110,7 @@ public class QueryWithPartitionsIntegrationTest extends AbstractBasicIntegration
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RecursiveCteIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RecursiveCteIntegrationTest.java
index 6ca5e893449..32b11f92144 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RecursiveCteIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RecursiveCteIntegrationTest.java
@@ -22,7 +22,7 @@ import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Integration tests for recursive common table expressions.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ResultSetSizeMetricsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ResultSetSizeMetricsTest.java
index 95430e21e5e..df147689040 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ResultSetSizeMetricsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ResultSetSizeMetricsTest.java
@@ -23,7 +23,7 @@ import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.metric.MetricRegistryImpl;
import org.apache.ignite.internal.processors.metric.impl.HistogramMetricImpl;
import org.apache.ignite.internal.processors.metric.impl.MaxValueMetric;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.running.RunningQueryManager.SQL_USER_QUERIES_REG_NAME;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RunningQueriesIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RunningQueriesIntegrationTest.java
index 4c8d83cc309..3f5d6a21e66 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RunningQueriesIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RunningQueriesIntegrationTest.java
@@ -61,11 +61,13 @@ import org.apache.ignite.spi.metric.LongMetric;
import org.apache.ignite.spi.systemview.view.SqlQueryView;
import org.apache.ignite.spi.systemview.view.SystemView;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static java.util.stream.Collectors.joining;
import static org.apache.ignite.IgniteSystemProperties.getLong;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.FRAMEWORK_CONFIG;
@@ -76,10 +78,11 @@ import static org.apache.ignite.internal.processors.query.running.RunningQueryMa
/**
*
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = IGNITE_CALCITE_PLANNER_TIMEOUT, value = "2000")
public class RunningQueriesIntegrationTest extends AbstractBasicIntegrationTest {
/** */
- private static final long PLANNER_TIMEOUT = getLong(IGNITE_CALCITE_PLANNER_TIMEOUT, 0);
+ private static long plannerTimeout;
/** */
private static IgniteEx srv;
@@ -88,9 +91,12 @@ public class RunningQueriesIntegrationTest extends AbstractBasicIntegrationTest
private static final long TIMEOUT_IN_MS = 10_000;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
+ plannerTimeout = getLong(IGNITE_CALCITE_PLANNER_TIMEOUT, 0);
+
srv = grid(0);
}
@@ -326,7 +332,7 @@ public class RunningQueriesIntegrationTest extends AbstractBasicIntegrationTest
try {
AtomicReference<List<List<?>>> res = new AtomicReference<>();
- GridTestUtils.assertTimeout(3 * PLANNER_TIMEOUT, TimeUnit.MILLISECONDS, () -> {
+ GridTestUtils.assertTimeout(3 * plannerTimeout, TimeUnit.MILLISECONDS, () -> {
res.set(sql(longJoinQry));
});
@@ -340,9 +346,9 @@ public class RunningQueriesIntegrationTest extends AbstractBasicIntegrationTest
DistributedSqlConfiguration distrCfg = queryProcessor(client).distributedConfiguration();
try {
- distrCfg.defaultQueryTimeout((int)PLANNER_TIMEOUT / 3).get();
+ distrCfg.defaultQueryTimeout((int)plannerTimeout / 3).get();
- GridTestUtils.assertTimeout(PLANNER_TIMEOUT, TimeUnit.MILLISECONDS, () -> {
+ GridTestUtils.assertTimeout(plannerTimeout, TimeUnit.MILLISECONDS, () -> {
sql(longJoinQry + " AND 1=1"); // Modify SQL to skip cached plan.
});
}
@@ -398,7 +404,7 @@ public class RunningQueriesIntegrationTest extends AbstractBasicIntegrationTest
latch.countDown();
}
- assertTrue(GridTestUtils.waitForCondition(() -> F.isEmpty(engine.runningQueries()), PLANNER_TIMEOUT * 2));
+ assertTrue(GridTestUtils.waitForCondition(() -> F.isEmpty(engine.runningQueries()), plannerTimeout * 2));
}
/** */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ScalarInIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ScalarInIntegrationTest.java
index 0e4fc7d461d..98e92d055af 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ScalarInIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ScalarInIntegrationTest.java
@@ -19,13 +19,15 @@ package org.apache.ignite.internal.processors.query.calcite.integration;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Test scalar IN operator.
*/
public class ScalarInIntegrationTest extends AbstractBasicIntegrationTest {
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectByKeyFieldTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectByKeyFieldTest.java
index 9a3c56c98fe..e5c1ee8dcb9 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectByKeyFieldTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectByKeyFieldTest.java
@@ -28,8 +28,8 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.hamcrest.CoreMatchers;
import org.jetbrains.annotations.Nullable;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import static java.util.stream.Collectors.toList;
import static org.apache.ignite.internal.processors.query.QueryUtils.KEY_FIELD_NAME;
@@ -128,7 +128,7 @@ public class SelectByKeyFieldTest extends AbstractBasicIntegrationTest {
/** */
@Test
- @Ignore("https://issues.apache.org/jira/browse/IGNITE-28374")
+ @Disabled("https://issues.apache.org/jira/browse/IGNITE-28374")
public void testCompositePkWithKeyTypeAndPersonCompositeKey() {
checkCompositePk(true, false, null);
}
@@ -165,7 +165,7 @@ public class SelectByKeyFieldTest extends AbstractBasicIntegrationTest {
/** */
@Test
- @Ignore("https://issues.apache.org/jira/browse/IGNITE-28374")
+ @Disabled("https://issues.apache.org/jira/browse/IGNITE-28374")
public void testCompositePkWithPersonCompositeKeyAndDifferentCmpOperations() {
checkCompositePkWithDifferentCmpOperations(false);
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectForUpdateIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectForUpdateIntegrationTest.java
index c450ea1ad21..3117aa62e71 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectForUpdateIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SelectForUpdateIntegrationTest.java
@@ -34,7 +34,10 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.processors.query.calcite.util.IgniteResource;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.transactions.Transaction;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTransactionalTest.SqlTransactionMode.ALL;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
@@ -61,6 +64,7 @@ public class SelectForUpdateIntegrationTest extends AbstractBasicIntegrationTest
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
@@ -69,6 +73,7 @@ public class SelectForUpdateIntegrationTest extends AbstractBasicIntegrationTest
}
/** {@inheritDoc} */
+ @AfterAll
@Override protected void afterTestsStopped() throws Exception {
ignite0 = null;
ignite1 = null;
@@ -106,6 +111,7 @@ public class SelectForUpdateIntegrationTest extends AbstractBasicIntegrationTest
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java
index 6d1bdbb9296..418da2eb841 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java
@@ -39,7 +39,7 @@ import org.apache.ignite.internal.processors.query.stat.StatisticsKey;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for server side statistics usage.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SetOpIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SetOpIntegrationTest.java
index 718937962e0..fee789bbe94 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SetOpIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SetOpIntegrationTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Integration test for set op (EXCEPT, INTERSECT).
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
index dd802750931..b1e5df5346c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
@@ -30,7 +30,7 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.query.calcite.exec.rel.AbstractNode;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Sort aggregate integration test.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlDiagnosticIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlDiagnosticIntegrationTest.java
index 5eb2f511ec0..98cce7e4e4c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlDiagnosticIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlDiagnosticIntegrationTest.java
@@ -74,6 +74,7 @@ import org.apache.ignite.internal.util.GridTestClockTimer;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.metric.MetricRegistry;
import org.apache.ignite.spi.metric.LongMetric;
@@ -82,9 +83,12 @@ import org.apache.ignite.spi.systemview.view.SystemView;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.junit.Test;
-
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_STARVATION_CHECK_INTERVAL;
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED;
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_OBJECT_READ;
@@ -111,6 +115,7 @@ import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
/**
* Test SQL diagnostic tools.
*/
+@ExtendWith(SystemPropertiesExtension.class)
public class SqlDiagnosticIntegrationTest extends AbstractBasicIntegrationTest {
/** */
private static final String jdbcUrl = "jdbc:ignite:thin://127.0.0.1:" + ClientConnectorConfiguration.DFLT_PORT;
@@ -144,14 +149,19 @@ public class SqlDiagnosticIntegrationTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
// No-op.
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
+ // Clear log throttle.
+ LT.clear();
+
cleanPersistenceDir();
log = new ListeningTestLogger(log());
@@ -874,7 +884,6 @@ public class SqlDiagnosticIntegrationTest extends AbstractBasicIntegrationTest {
assertTrue(logLsnr2.check(1000L));
}
-
/** */
@Test
@WithSystemProperty(key = IGNITE_STARVATION_CHECK_INTERVAL, value = "100")
@@ -924,7 +933,7 @@ public class SqlDiagnosticIntegrationTest extends AbstractBasicIntegrationTest {
/** */
@Test
- public void testUdfQueryDeadlockDetectionStripedExecutor() throws Exception {
+ public void testUdfQueryDeadlockDetectionStripedExecutor() {
IgniteEx ignite = grid(0);
assertTrue(queryProcessor(ignite).taskExecutor() instanceof StripedQueryTaskExecutor);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java
index e2d0671b869..54369aabf2e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SqlPlanHistoryIntegrationTest.java
@@ -45,29 +45,34 @@ import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryEngineConfigurationEx;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.spi.systemview.view.SqlPlanHistoryView;
import org.apache.ignite.spi.systemview.view.SystemView;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.AssumptionViolatedException;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.opentest4j.TestAbortedException;
import static org.apache.ignite.configuration.SqlConfiguration.DFLT_SQL_PLAN_HISTORY_SIZE;
import static org.apache.ignite.internal.processors.performancestatistics.AbstractPerformanceStatisticsTest.startCollectStatistics;
import static org.apache.ignite.internal.processors.query.running.RunningQueryManager.SQL_PLAN_HIST_VIEW;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
/** Tests for SQL plan history. */
-@RunWith(Parameterized.class)
-public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "sqlEngine={0}, isClient={1} loc={2}, isFullyFetched={3}, isPerfStatsEnabled={4}")
+@MethodSource("params")
+public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractWrapperTest {
/** SQL plan history size excess. */
private static final int PLAN_HISTORY_EXCESS = 2;
@@ -119,30 +124,29 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
private int planHistorySize = 10;
/** SQL engine. */
- @Parameterized.Parameter
+ @Parameter(0)
public String sqlEngine;
/** Client mode flag. */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public boolean isClient;
/** Local query flag. */
- @Parameterized.Parameter(2)
+ @Parameter(2)
public boolean loc;
/** Fully-fetched query flag. */
- @Parameterized.Parameter(3)
+ @Parameter(3)
public boolean isFullyFetched;
/** Flag indicating whether the collection of performance statistics is enabled. */
- @Parameterized.Parameter(4)
+ @Parameter(4)
public boolean isPerfStatsEnabled;
/**
* @return Test parameters.
*/
- @Parameterized.Parameters(name = "sqlEngine={0}, isClient={1} loc={2}, isFullyFetched={3}, isPerfStatsEnabled={4}")
- public static Collection<Object[]> params() {
+ private static Collection<Arguments> params() {
return Arrays.stream(new Object[][]{
{CalciteQueryEngineConfiguration.ENGINE_NAME},
{IndexingQueryEngineConfiguration.ENGINE_NAME}
@@ -151,8 +155,8 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
.flatMap(isClient -> Arrays.stream(isClient ? new Boolean[]{false} : new Boolean[]{true, false})
.flatMap(loc -> Arrays.stream(new Boolean[]{true, false})
.flatMap(isFullyFetched -> Arrays.stream(new Boolean[]{true, false})
- .map(isPerfStatsEnabled -> new Object[]{sqlEngine[0], isClient, loc, isFullyFetched, isPerfStatsEnabled}))))
- ).collect(Collectors.toList());
+ .map(isPerfStatsEnabled -> Arguments.of(sqlEngine[0], isClient, loc, isFullyFetched, isPerfStatsEnabled))))
+ )).collect(Collectors.toList());
}
/** {@inheritDoc} */
@@ -241,10 +245,20 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
stopAllGrids();
}
+ /** */
+ @BeforeEach
+ public void setup() throws Exception {
+ isSqlEngineConfigured = true;
+ isSqlConfigured = true;
+ isPlanHistorySizeSet = true;
+ planHistorySize = 10;
+ }
+
/** Checks successful JDBC queries. */
@Test
public void testJdbcQuery() throws Exception {
@@ -262,7 +276,7 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
jdbcQuery(SQL_FAILED);
}
catch (Exception e) {
- if (e instanceof AssumptionViolatedException)
+ if (e instanceof TestAbortedException)
throw e;
}
@@ -299,10 +313,10 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
*/
@Test
public void testSqlFieldsQueryWithReducePhase() throws Exception {
- assumeTrue("Map/reduce queries are only applicable to H2 engine",
- sqlEngine == IndexingQueryEngineConfiguration.ENGINE_NAME);
+ assumeTrue(sqlEngine == IndexingQueryEngineConfiguration.ENGINE_NAME,
+ "Map/reduce queries are only applicable to H2 engine");
- assumeFalse("Only distributed queries have map and reduce phases", loc);
+ assumeFalse(loc, "Only distributed queries have map and reduce phases");
startTestGrid();
@@ -510,8 +524,8 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
*/
@Test
public void testNoScanCountSuffix() throws Exception {
- assumeTrue("ScanCount suffix can only be present in H2 local query plans",
- sqlEngine == IndexingQueryEngineConfiguration.ENGINE_NAME && loc);
+ assumeTrue(sqlEngine == IndexingQueryEngineConfiguration.ENGINE_NAME && loc,
+ "ScanCount suffix can only be present in H2 local query plans");
assumeFalse(isPerfStatsEnabled);
@@ -540,8 +554,8 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
/** Tests that H2 query plans for UNION operations do not contain 'scanCount' suffix. */
@Test
public void testNoScanCountSuffixForUNION() throws Exception {
- assumeTrue("ScanCount suffix can only be present in H2 local query plans",
- IndexingQueryEngineConfiguration.ENGINE_NAME.equals(sqlEngine) && loc);
+ assumeTrue(IndexingQueryEngineConfiguration.ENGINE_NAME.equals(sqlEngine) && loc,
+ "ScanCount suffix can only be present in H2 local query plans");
startTestGrid();
@@ -615,7 +629,7 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
* @param qryText Query text.
*/
private void jdbcQuery(String qryText) throws Exception {
- assumeFalse("There is no 'local query' parameter for JDBC queries", loc);
+ assumeFalse(loc, "There is no 'local query' parameter for JDBC queries");
if (Ignition.allGrids().isEmpty())
startTestGrid();
@@ -655,7 +669,7 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
* @param qrysInfo DML commands info (command text, simple query flag).
*/
public void runJdbcDml(IgniteBiTuple<List<String>, Boolean> qrysInfo) throws Exception {
- assumeFalse("There is no 'local query' parameter for JDBC queries", loc);
+ assumeFalse(loc, "There is no 'local query' parameter for JDBC queries");
executeDml(qrysInfo, (cmds) -> {
try (
@@ -687,7 +701,7 @@ public class SqlPlanHistoryIntegrationTest extends GridCommonAbstractTest {
* @param task Task to be executed.
*/
public void executeDml(IgniteBiTuple<List<String>, Boolean> qrysInfo, Consumer<List<String>> task) throws Exception {
- assumeTrue("There is no lazy mode for DML operations", isFullyFetched);
+ assumeTrue(isFullyFetched, "There is no lazy mode for DML operations");
startTestGrid();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StatisticsCommandDdlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StatisticsCommandDdlIntegrationTest.java
index 3817d0131df..404ce207ae4 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StatisticsCommandDdlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StatisticsCommandDdlIntegrationTest.java
@@ -31,8 +31,8 @@ import org.apache.ignite.internal.processors.query.stat.ObjectStatisticsImpl;
import org.apache.ignite.internal.processors.query.stat.StatisticsKey;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
-
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -60,6 +60,7 @@ public class StatisticsCommandDdlIntegrationTest extends AbstractDdlIntegrationT
private static final String NAME_FIELD = "NAME";
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StdSqlOperatorsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StdSqlOperatorsTest.java
index 2f78ee9c6f7..00ae12ff0ea 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StdSqlOperatorsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/StdSqlOperatorsTest.java
@@ -29,7 +29,8 @@ import java.util.stream.IntStream;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.sql.fun.IgniteStdSqlOperatorTable;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Ignite's SQL dialect test.
@@ -39,6 +40,7 @@ import org.junit.Test;
*/
public class StdSqlOperatorsTest extends AbstractBasicIntegrationTest {
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemColumnsScanTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemColumnsScanTest.java
index c62402703cc..956ce77e171 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemColumnsScanTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemColumnsScanTest.java
@@ -44,11 +44,13 @@ import org.apache.ignite.internal.processors.query.calcite.schema.ColumnDescript
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteCacheTable;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteIndex;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/** Tests system columns returned by direct table and index scans. */
public class SystemColumnsScanTest extends AbstractBasicIntegrationTest {
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemViewsIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemViewsIntegrationTest.java
index 58f5989f661..c34ac41eb59 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemViewsIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SystemViewsIntegrationTest.java
@@ -24,8 +24,7 @@ import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.util.IgniteResource;
import org.hamcrest.Matcher;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CLIENT_MODE;
/**
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java
index a4ace5c795e..101b61945aa 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java
@@ -55,14 +55,13 @@ import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.hamcrest.CustomMatcher;
import org.hamcrest.Matcher;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.MarshallerPlatformIds.JAVA_ID;
import static org.apache.ignite.internal.processors.query.calcite.TestUtils.hasSize;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
/** */
public class TableDdlIntegrationTest extends AbstractDdlIntegrationTest {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java
index f94c45162fb..f194fe23b3f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java
@@ -42,7 +42,7 @@ import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/** */
public class TableDmlIntegrationTest extends AbstractBasicIntegrationTransactionalTest {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TestSuiteDeclarationArchTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TestSuiteDeclarationArchTest.java
new file mode 100644
index 00000000000..16917170046
--- /dev/null
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TestSuiteDeclarationArchTest.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ignite.internal.processors.query.calcite.integration;
+
+import java.util.Set;
+import com.tngtech.archunit.core.domain.JavaClass;
+import com.tngtech.archunit.core.domain.JavaClasses;
+import com.tngtech.archunit.core.domain.JavaMethod;
+import com.tngtech.archunit.core.domain.JavaModifier;
+import com.tngtech.archunit.core.importer.ClassFileImporter;
+import com.tngtech.archunit.core.importer.ImportOption;
+import com.tngtech.archunit.core.importer.Location;
+import com.tngtech.archunit.junit.AnalyzeClasses;
+import com.tngtech.archunit.junit.ArchTest;
+import com.tngtech.archunit.junit.LocationProvider;
+import com.tngtech.archunit.lang.ArchCondition;
+import com.tngtech.archunit.lang.ArchRule;
+import com.tngtech.archunit.lang.ConditionEvents;
+import com.tngtech.archunit.lang.SimpleConditionEvent;
+import org.junit.jupiter.api.Order;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
+
+import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.methods;
+
+/** Arch tests for legacy junit related code detection. */
+@AnalyzeClasses(
+ importOptions = ImportOption.OnlyIncludeTests.class,
+ locations = TestSuiteDeclarationArchTest.CalciteLocationProvider.class)
+@Order(1)
+public class TestSuiteDeclarationArchTest {
+ /** */
+ private static JavaClasses allClassesCache;
+
+ /**
+ * Resolves compiled test classes of the calcite module (i.e. {@code modules/calcite/target/test-classes}).
+ * The location is derived from the test class itself instead of the working directory, because with
+ * {@code forkCount=0} the working directory is the one Maven was started from (e.g. the repository root),
+ * which would make the rules scan every module.
+ */
+ static class CalciteLocationProvider implements LocationProvider {
+ /** */
+ @Override public Set<Location> get(Class<?> testCls) {
+ return Set.of(calciteTestClassesLocation());
+ }
+ }
+
+ /** @return Location of the calcite module compiled test classes. */
+ private static Location calciteTestClassesLocation() {
+ return Location.of(TestSuiteDeclarationArchTest.class.getProtectionDomain().getCodeSource().getLocation());
+ }
+
+ /** Check that no legacy junit annotations are defined. */
+ @ArchTest
+ @SuppressWarnings("unused")
+ static final ArchRule CHECK_LEGACY_TESTS =
+ methods()
+ .that().areAnnotatedWith(org.junit.Test.class)
+ .should(new ArchCondition<JavaMethod>("Legacy JUnit defined test with: @org.junit.Test") {
+ @Override public void check(JavaMethod method, ConditionEvents events) {
+ events.add(SimpleConditionEvent.violated(method, "Unexpected test annotation: " + method.getFullName()));
+ }
+ })
+ .allowEmptyShould(true);
+
+ /** Check that all junit test related classes are present in @Suite definitions. */
+ @ArchTest
+ @SuppressWarnings("unused")
+ static final ArchRule CHECK_ALL_TEST_CLASSES_IN_SUITE =
+ methods()
+ .that().areAnnotatedWith(org.junit.jupiter.api.Test.class)
+ .should(new ArchCondition<JavaMethod>("be declared in a class listed in @SelectClasses of a @Suite") {
+ /** */
+ @Override public void check(JavaMethod method, ConditionEvents events) {
+ // Lazy load all classes to avoid repeated scanning
+ if (allClassesCache == null) {
+ allClassesCache = new ClassFileImporter()
+ .importLocations(Set.of(calciteTestClassesLocation()));
+ }
+
+ JavaClass ownerCls = method.getOwner();
+
+ if (ownerCls.getModifiers().stream().anyMatch(m -> m == JavaModifier.ABSTRACT))
+ return;
+
+ boolean isInSuite = allClassesCache.stream()
+ .filter(cls -> cls.isAnnotatedWith(Suite.class))
+ .anyMatch(suite -> isClassReferencedInSuite(suite, ownerCls));
+
+ if (!isInSuite) {
+ String msg = String.format(
+ "Method %s#%s is in a class that is not listed in any @SelectClasses.",
+ ownerCls.getFullName(), method.getName()
+ );
+ events.add(SimpleConditionEvent.violated(method, msg));
+ }
+ }
+
+ private boolean isClassReferencedInSuite(JavaClass suiteClass, JavaClass testClass) {
+ SelectClasses selectClasses = suiteClass.reflect().getAnnotation(SelectClasses.class);
+ if (selectClasses != null) {
+ for (Class<?> selected : selectClasses.value()) {
+ if (selected.getName().equals(testClass.getFullName())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ });
+}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TimeoutIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TimeoutIntegrationTest.java
index 6ef1f6bbff5..4800d181a1c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TimeoutIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TimeoutIntegrationTest.java
@@ -46,8 +46,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.spi.metric.LongMetric;
import org.apache.ignite.testframework.GridTestUtils;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.running.RunningQueryManager.SQL_USER_QUERIES_REG_NAME;
/**
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnnestIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnnestIntegrationTest.java
index bec275f95bb..87c075570c7 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnnestIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnnestIntegrationTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.query.calcite.integration;
import java.util.Collections;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Integration test for UNNEST operator.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnstableTopologyIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnstableTopologyIntegrationTest.java
index 120642ee2b1..834e1283963 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnstableTopologyIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UnstableTopologyIntegrationTest.java
@@ -44,12 +44,16 @@ import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.indexing.IndexingQueryFilter;
import org.apache.ignite.spi.indexing.IndexingSpi;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/** Non-stable topology tests. */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "awaitExchange={0}, idxSlowDown={1}")
+@MethodSource("parameters")
public class UnstableTopologyIntegrationTest extends AbstractBasicIntegrationTest {
/** */
private static final String POI_CACHE_NAME = "POI_CACHE";
@@ -78,26 +82,26 @@ public class UnstableTopologyIntegrationTest extends AbstractBasicIntegrationTes
/** */
private static final int NUM_ENTITIES = 2_000;
- /** Test parameters. */
- @Parameterized.Parameters(name = "awaitExchange={0}, idxSlowDown={1}")
- public static List<Object[]> parameters() {
+ /** */
+ private static List<Arguments> parameters() {
return ImmutableList.of(
- new Object[]{true, true},
- new Object[]{true, false},
- new Object[]{false, false},
- new Object[]{false, true}
+ Arguments.of(true, true),
+ Arguments.of(true, false),
+ Arguments.of(false, false),
+ Arguments.of(false, true)
);
}
/** */
- @Parameterized.Parameter()
+ @Parameter(0)
public boolean awaitExchange;
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public boolean idxSlowDown;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
// No-op. We don't need to start anything.
}
@@ -144,8 +148,6 @@ public class UnstableTopologyIntegrationTest extends AbstractBasicIntegrationTes
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
stopAllGrids(true);
-
- super.afterTest();
}
/**
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDdlIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDdlIntegrationTest.java
index b12ed29ad42..4a6d7a95854 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDdlIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDdlIntegrationTest.java
@@ -25,7 +25,7 @@ import org.apache.ignite.internal.processors.authentication.IgniteAccessControlE
import org.apache.ignite.internal.processors.security.SecurityContext;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.authentication.AuthenticationProcessorSelfTest.authenticate;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTest.java
index ed3654f13dc..4cc56827866 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTest.java
@@ -52,15 +52,18 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import org.hamcrest.CoreMatchers;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR;
/**
* Integration test for user defined functions.
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR, value = "true")
public class UserDefinedFunctionsIntegrationTest extends AbstractBasicIntegrationTest {
/** Log listener. */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTransactionalTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTransactionalTest.java
index c1d9d1b5438..af86a09d85f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTransactionalTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedFunctionsIntegrationTransactionalTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.query.calcite.integration;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Integration test for user defined functions.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedTxAwareFunctionsIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedTxAwareFunctionsIntegrationTest.java
index e9824582388..4813b35bd94 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedTxAwareFunctionsIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/UserDefinedTxAwareFunctionsIntegrationTest.java
@@ -32,20 +32,22 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
import org.apache.ignite.transactions.Transaction;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Integration test for user defined functions with tx aware.
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR, value = "true")
public class UserDefinedTxAwareFunctionsIntegrationTest extends AbstractBasicIntegrationTest {
/** */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ViewsIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ViewsIntegrationTest.java
index f6a284baf9b..9e26de4d6ed 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ViewsIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ViewsIntegrationTest.java
@@ -27,7 +27,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.util.typedef.G;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/** */
public class ViewsIntegrationTest extends AbstractMultiEngineIntegrationTest {
@@ -51,9 +52,19 @@ public class ViewsIntegrationTest extends AbstractMultiEngineIntegrationTest {
}
/** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- super.afterTest();
+ @BeforeEach
+ @Override protected void beforeTest() throws Exception {
+ persistenceEnabled = false;
+
+ assertTrue("Not all Ignite instances stopped before tests execution:" + G.allGrids(), G.allGrids().isEmpty());
+
+ super.beforeTest();
+
+ cleanPersistenceDir();
+ }
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
stopAllGrids();
cleanPersistenceDir();
@@ -244,7 +255,7 @@ public class ViewsIntegrationTest extends AbstractMultiEngineIntegrationTest {
* Tests view after persistent grid restart.
*/
@Test
- public void testPersistance() throws Exception {
+ public void testPersistence() throws Exception {
persistenceEnabled = true;
initGrids(3);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/WindowIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/WindowIntegrationTest.java
index 43ff9fa0eb5..6a0a9fc93c2 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/WindowIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/WindowIntegrationTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Integration test for WINDOW operator.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java
index 8f0e410bb9f..1e3d46a3ae1 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java
@@ -18,32 +18,39 @@
package org.apache.ignite.internal.processors.query.calcite.integration.tpch;
import java.util.Collection;
+import java.util.concurrent.TimeUnit;
import org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
/** */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "queryId={0}")
+@MethodSource("parameters")
public abstract class AbstractTpchTest extends AbstractBasicIntegrationTest {
/** */
protected static final Collection<Integer> USED_TESTS = F.asList(15, 16, 17, 19, 20);
/** Query ID. */
- @Parameterized.Parameter
+ @Parameter(0)
public int qryId;
/** */
protected abstract double scale();
/** */
- @Parameterized.Parameters(name = "queryId={0}")
- public static Collection<Integer> params() {
+ @MethodSource("parameters")
+ public static Collection<Integer> parameters() {
return USED_TESTS;
}
- /** {@inheritDoc} */
+ /** */
+ @BeforeAll
+ @Timeout(value = 10, unit = TimeUnit.MINUTES)
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale001Test.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale001Test.java
index 205cdea3339..23182a9f994 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale001Test.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale001Test.java
@@ -17,11 +17,7 @@
package org.apache.ignite.internal.processors.query.calcite.integration.tpch;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
/** */
-@RunWith(Parameterized.class)
public class TpchScale001Test extends AbstractTpchTest {
/** {@inheritDoc} */
@Override protected double scale() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale010Test.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale010Test.java
index b6d39f13f5d..e957ff7f5b5 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale010Test.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchScale010Test.java
@@ -17,11 +17,7 @@
package org.apache.ignite.internal.processors.query.calcite.integration.tpch;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
/** */
-@RunWith(Parameterized.class)
public class TpchScale010Test extends AbstractTpchTest {
/** */
@Override protected double scale() {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/AbstractJdbcTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/AbstractJdbcTest.java
index 0f956beb5ee..22f50fae58a 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/AbstractJdbcTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/AbstractJdbcTest.java
@@ -24,12 +24,12 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
/**
* Abstract JDBC test.
*/
-public abstract class AbstractJdbcTest extends GridCommonAbstractTest {
+public abstract class AbstractJdbcTest extends GridCommonAbstractWrapperTest {
/** URL. */
protected static final String URL = "jdbc:ignite:thin://127.0.0.1";
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcConnectionEnabledPropertyTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcConnectionEnabledPropertyTest.java
index b6cce49c10b..d84a9754d00 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcConnectionEnabledPropertyTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcConnectionEnabledPropertyTest.java
@@ -22,16 +22,17 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.cluster.DistributedConfigurationUtils.CONN_DISABLED_BY_ADMIN_ERR_MSG;
import static org.apache.ignite.internal.processors.configuration.distributed.DistributedConfigurationProcessor.toMetaStorageKey;
import static org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcThinTransactionalSelfTest.URL;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
/** */
-public class JdbcConnectionEnabledPropertyTest extends GridCommonAbstractTest {
+public class JdbcConnectionEnabledPropertyTest extends GridCommonAbstractWrapperTest {
/** */
private static final String JDBC_CONN_ENABLED_PROP = "newJdbcConnectionsEnabled";
@@ -45,12 +46,21 @@ public class JdbcConnectionEnabledPropertyTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
startGrid();
}
+ /** {@inheritDoc} */
+ @AfterAll
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
/** */
@Test
public void testConnectionEnabledProperty() throws Exception {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcCrossEngineTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcCrossEngineTest.java
index e3d7865d1f4..e725a0be6e6 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcCrossEngineTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcCrossEngineTest.java
@@ -32,7 +32,9 @@ import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Cross check queries on SQL engines.
@@ -64,6 +66,7 @@ public class JdbcCrossEngineTest extends AbstractJdbcTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
startGrids(nodesCnt);
@@ -78,6 +81,7 @@ public class JdbcCrossEngineTest extends AbstractJdbcTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
for (int i = 0; i < engineNames.length; i++) {
if (stmts[i] != null && !stmts[i].isClosed()) {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcLocalFlagTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcLocalFlagTest.java
index 687de37a8a2..1b1b46fc4a2 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcLocalFlagTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcLocalFlagTest.java
@@ -25,7 +25,8 @@ import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
/** */
public class JdbcLocalFlagTest extends AbstractJdbcTest {
@@ -40,6 +41,7 @@ public class JdbcLocalFlagTest extends AbstractJdbcTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() {
stopAllGrids();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcQueryTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcQueryTest.java
index a22e1c89643..3f2e582585f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcQueryTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcQueryTest.java
@@ -52,17 +52,22 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.WithSystemProperty;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.apache.ignite.testframework.junit.SystemPropertiesExtension;
+import org.apache.ignite.testframework.junit.WithSystemProperty;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
/**
*
*/
+@ExtendWith(SystemPropertiesExtension.class)
@WithSystemProperty(key = "calcite.debug", value = "true")
-public class JdbcQueryTest extends GridCommonAbstractTest {
+public class JdbcQueryTest extends GridCommonAbstractWrapperTest {
/** URL. */
private final String url = "jdbc:ignite:thin://127.0.0.1?queryEngine=" + CalciteQueryEngineConfiguration.ENGINE_NAME;
@@ -87,8 +92,9 @@ public class JdbcQueryTest extends GridCommonAbstractTest {
.setCacheConfiguration(ccfg);
}
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
+ /** */
+ @BeforeEach
+ void setup() throws Exception {
startGrids(nodesCnt);
connect(url);
@@ -112,6 +118,7 @@ public class JdbcQueryTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
if (stmt != null && !stmt.isClosed()) {
stmt.close();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoCacheInterceptorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoCacheInterceptorTest.java
index 300b10679d8..699b38dc325 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoCacheInterceptorTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoCacheInterceptorTest.java
@@ -21,8 +21,8 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
-import java.util.Collection;
import java.util.List;
+import java.util.stream.Stream;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.cache.CacheAtomicityMode;
@@ -34,22 +34,24 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.resources.SessionContextProviderResource;
import org.apache.ignite.session.SessionContextProvider;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import static org.junit.Assume.assumeFalse;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
/** */
-@RunWith(Parameterized.class)
-public class JdbcSetClientInfoCacheInterceptorTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "runInTx={0}, mode={1}")
+@MethodSource("data")
+public class JdbcSetClientInfoCacheInterceptorTest extends GridCommonAbstractWrapperTest {
/** */
private static final String SESSION_ID = "sessionId";
@@ -57,19 +59,19 @@ public class JdbcSetClientInfoCacheInterceptorTest extends GridCommonAbstractTes
private static final String URL = "jdbc:ignite:thin://127.0.0.1";
/** */
- @Parameterized.Parameter
+ @Parameter(0)
public boolean runInTx;
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public CacheAtomicityMode cacheMode;
/** */
- @Parameterized.Parameters(name = "runInTx={0}, mode={1}")
- public static Collection<Object[]> data() {
+ public static Stream<Arguments> data() {
return GridTestUtils.cartesianProduct(
- F.asList(false, true),
- F.asList(CacheAtomicityMode.TRANSACTIONAL, CacheAtomicityMode.ATOMIC));
+ List.of(false, true),
+ List.of(CacheAtomicityMode.TRANSACTIONAL, CacheAtomicityMode.ATOMIC)
+ ).stream().map(Arguments::of);
}
/** */
@@ -101,6 +103,7 @@ public class JdbcSetClientInfoCacheInterceptorTest extends GridCommonAbstractTes
}
/** */
+ @BeforeEach
@Override protected void beforeTest() {
assumeFalse(runInTx && cacheMode == CacheAtomicityMode.ATOMIC);
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoTest.java
index 5119b1f1c68..e48befa37fc 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcSetClientInfoTest.java
@@ -26,6 +26,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
+import java.util.stream.Stream;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.SqlFieldsQuery;
@@ -36,22 +37,26 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.resources.SessionContextProviderResource;
import org.apache.ignite.session.SessionContext;
import org.apache.ignite.session.SessionContextProvider;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import static org.junit.Assume.assumeFalse;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
/** */
-@RunWith(Parameterized.class)
-public class JdbcSetClientInfoTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "runInTx={0}, mode={1}")
+@MethodSource("data")
+public class JdbcSetClientInfoTest extends GridCommonAbstractWrapperTest {
/** */
private static final String SESSION_ID = "sessionId";
@@ -59,19 +64,21 @@ public class JdbcSetClientInfoTest extends GridCommonAbstractTest {
private static final String URL = "jdbc:ignite:thin://127.0.0.1";
/** */
- @Parameterized.Parameter
+ @Parameter(0)
public boolean runInTx;
/** */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public CacheAtomicityMode cacheMode;
/** */
- @Parameterized.Parameters(name = "runInTx={0}, mode={1}")
- public static Collection<Object[]> data() {
- return GridTestUtils.cartesianProduct(
- F.asList(false, true),
- F.asList(CacheAtomicityMode.TRANSACTIONAL, CacheAtomicityMode.ATOMIC));
+ private static Stream<Arguments> data() {
+ Stream<Arguments> res = GridTestUtils.cartesianProduct(
+ List.of(false, true),
+ List.of(CacheAtomicityMode.TRANSACTIONAL, CacheAtomicityMode.ATOMIC)
+ ).stream().map(Arguments::of);
+
+ return res;
}
/** {@inheritDoc} */
@@ -102,15 +109,17 @@ public class JdbcSetClientInfoTest extends GridCommonAbstractTest {
return cfg;
}
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
+ /** */
+ @BeforeEach
+ public void setup() throws Exception {
assumeFalse(runInTx && cacheMode == CacheAtomicityMode.ATOMIC);
startGrids(3);
}
- /** {@inheritDoc} */
- @Override protected void afterTest() {
+ /** */
+ @AfterEach
+ public void cleanUp() {
stopAllGrids();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinConnectionSavepointTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinConnectionSavepointTest.java
index 8e470ccab39..d6594aca87c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinConnectionSavepointTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinConnectionSavepointTest.java
@@ -22,25 +22,29 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Savepoint;
import java.sql.Statement;
-import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.transactions.TransactionConcurrency;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
/** Savepoint tests for thin JDBC connection. */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "{0}")
+@MethodSource("testData")
public class JdbcThinConnectionSavepointTest extends AbstractJdbcTest {
/** */
private static final String TBL = "SAVEPOINT_TEST_TABLE";
@@ -55,12 +59,11 @@ public class JdbcThinConnectionSavepointTest extends AbstractJdbcTest {
/**
* @return Test parameters.
*/
- @Parameters(name = "{0}")
- public static Iterable<Object[]> testData() {
- return Arrays.asList(new Object[][] {
- {PESSIMISTIC},
- {OPTIMISTIC}
- });
+ private static Collection<Arguments> testData() {
+ return List.of(
+ Arguments.of(PESSIMISTIC),
+ Arguments.of(OPTIMISTIC)
+ );
}
/** {@inheritDoc} */
@@ -73,6 +76,7 @@ public class JdbcThinConnectionSavepointTest extends AbstractJdbcTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
@@ -80,6 +84,7 @@ public class JdbcThinConnectionSavepointTest extends AbstractJdbcTest {
}
/** {@inheritDoc} */
+ @AfterAll
@Override protected void afterTestsStopped() throws Exception {
stopAllGrids();
@@ -87,6 +92,7 @@ public class JdbcThinConnectionSavepointTest extends AbstractJdbcTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -287,6 +293,6 @@ public class JdbcThinConnectionSavepointTest extends AbstractJdbcTest {
assertEquals(exp.length / 2, rows.size());
for (int i = 0; i < exp.length; i += 2)
- assertEqualsCollections(Arrays.asList(exp[i], exp[i + 1]), rows.get(i / 2));
+ assertEqualsCollections(List.of(exp[i], exp[i + 1]), rows.get(i / 2));
}
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinTransactionalSelfTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinTransactionalSelfTest.java
index 7120f15e2e0..98212b37bc4 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinTransactionalSelfTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/jdbc/JdbcThinTransactionalSelfTest.java
@@ -24,19 +24,22 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.IgniteConfigVariationsAbstractTest.TestRunnable;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.TransactionConcurrency;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static java.sql.Connection.TRANSACTION_NONE;
import static java.sql.Connection.TRANSACTION_READ_COMMITTED;
import static java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
@@ -49,16 +52,16 @@ import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
/** */
-@RunWith(Parameterized.class)
-public class JdbcThinTransactionalSelfTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "partitionAwareness={0}")
+@MethodSource("parameters")
+public class JdbcThinTransactionalSelfTest extends GridCommonAbstractWrapperTest {
/** */
- @Parameterized.Parameter
+ @Parameter
public boolean partitionAwareness;
/** */
- @Parameterized.Parameters(name = "partitionAwareness={0}")
- public static Object[] parameters() {
- return new Object[] {false, true};
+ private static Collection<Arguments> parameters() {
+ return List.of(Arguments.of(false), Arguments.of(true));
}
/** URL. */
@@ -75,12 +78,21 @@ public class JdbcThinTransactionalSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
startGrid();
}
+ /** {@inheritDoc} */
+ @AfterAll
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
/** */
@Test
public void testDatabaseMetadata() throws Exception {
@@ -103,7 +115,7 @@ public class JdbcThinTransactionalSelfTest extends GridCommonAbstractTest {
@Test
public void testInvalidHoldability() throws Exception {
try (Connection conn = DriverManager.getConnection(url())) {
- List<TestRunnable> checks = Arrays.asList(
+ List<TestRunnable> checks = List.of(
() -> conn.setHoldability(HOLD_CURSORS_OVER_COMMIT),
() -> conn.createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT),
() -> conn.prepareStatement("SELECT * FROM T", TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT)
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/logical/ScriptTestRunner.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/logical/ScriptTestRunner.java
deleted file mode 100644
index 24899ef5489..00000000000
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/logical/ScriptTestRunner.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.calcite.logical;
-
-import java.nio.file.FileSystem;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.List;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.regex.Pattern;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.IgnitionEx;
-import org.apache.ignite.internal.processors.query.QueryEngine;
-import org.apache.ignite.internal.processors.query.calcite.util.Commons;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
-import org.apache.ignite.thread.IgniteThread;
-import org.junit.runner.Description;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunNotifier;
-
-/**
- *
- */
-public class ScriptTestRunner extends Runner {
- /** Filesystem. */
- private static final FileSystem FS = FileSystems.getDefault();
-
- /** Shared finder. */
- private static final TcpDiscoveryVmIpFinder sharedFinder = new TcpDiscoveryVmIpFinder().setShared(true);
-
- /** */
- private static IgniteLogger log;
-
- static {
- try {
- log = new GridTestLog4jLogger(U.resolveIgnitePath("modules/core/src/test/config/log4j2-test.xml"));
- }
- catch (Exception e) {
- e.printStackTrace(System.err);
-
- log = null;
-
- assert false : "Cannot init logger";
- }
- }
-
- /** */
- private final Class<?> testCls;
-
- /** Scripts root directory. */
- private final Path scriptsRoot;
-
- /** Regex to filter test path to run only specified tests. */
- private final Pattern testRegex;
-
- /** Nodes count. */
- private final int nodes;
-
- /** Restart cluster for each test group. */
- private final boolean restartCluster;
-
- /** Test script timeout. */
- private final long timeout;
-
- /** */
- public ScriptTestRunner(Class<?> testCls) {
- this.testCls = testCls;
- ScriptRunnerTestsEnvironment env = testCls.getAnnotation(ScriptRunnerTestsEnvironment.class);
-
- assert !F.isEmpty(env.scriptsRoot());
-
- nodes = env.nodes();
- scriptsRoot = FS.getPath(U.resolveIgnitePath(env.scriptsRoot()).getPath());
- testRegex = F.isEmpty(env.regex()) ? null : Pattern.compile(env.regex());
- restartCluster = env.restart();
- timeout = env.timeout();
- }
-
- /** {@inheritDoc} */
- @Override public Description getDescription() {
- return Description.createSuiteDescription(testCls.getName(), "scripts");
- }
-
- /** {@inheritDoc} */
- @Override public void run(final RunNotifier notifier) {
- try {
- Files.walk(scriptsRoot).sorted().forEach((p) -> {
- if (p.equals(scriptsRoot))
- return;
-
- if (Files.isDirectory(p)) {
- if (!F.isEmpty(Ignition.allGrids()) && restartCluster) {
- log.info(">>> Restart cluster");
-
- Ignition.stopAll(false);
- }
-
- return;
- }
-
- runTest(p, notifier);
- });
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- finally {
- Ignition.stopAll(false);
- }
- }
-
- /** */
- private void runTest(Path test, RunNotifier notifier) {
- String dirName;
- if (test.getNameCount() - 1 > scriptsRoot.getNameCount())
- dirName = test.subpath(scriptsRoot.getNameCount(), test.getNameCount() - 1).toString();
- else
- dirName = scriptsRoot.subpath(scriptsRoot.getNameCount() - 1, scriptsRoot.getNameCount()).toString();
-
- String fileName = test.getFileName().toString();
-
- Description desc = Description.createTestDescription(dirName, fileName);
-
- if (testRegex != null && !testRegex.matcher(test.toString()).find())
- return;
-
- if (testRegex == null && !fileName.endsWith(".test") && !fileName.endsWith(".test_slow")) {
- if (fileName.endsWith(".test_ignore"))
- notifier.fireTestIgnored(desc);
-
- return;
- }
-
- beforeTest();
-
- notifier.fireTestStarted(desc);
-
- try {
- Ignite ign = F.first(Ignition.allGrids());
-
- QueryEngine engine = Commons.lookupComponent(
- ((IgniteEx)ign).context(),
- QueryEngine.class
- );
-
- SqlScriptRunner scriptTestRunner = new SqlScriptRunner(test, engine, log);
-
- log.info(">>> Start: " + dirName + "/" + fileName);
-
- runScript(scriptTestRunner);
- }
- catch (Throwable e) {
- notifier.fireTestFailure(new Failure(desc, e));
- }
- finally {
- log.info(">>> Finish: " + dirName + "/" + fileName);
- notifier.fireTestFinished(desc);
- }
- }
-
- /** */
- private void beforeTest() {
- if (F.isEmpty(Ignition.allGrids()))
- startCluster();
- else {
- Ignite ign = F.first(Ignition.allGrids());
-
- for (String cacheName : ign.cacheNames())
- ign.destroyCache(cacheName);
- }
- }
-
- /** */
- private void startCluster() {
- for (int i = 0; i < nodes; ++i) {
- Ignition.start(
- new IgniteConfiguration()
- .setIgniteInstanceName("srv" + i)
- .setDiscoverySpi(
- new TcpDiscoverySpi()
- .setIpFinder(sharedFinder)
- )
- .setGridLogger(log)
- );
- }
- }
-
- /** */
- private void runScript(SqlScriptRunner scriptRunner) throws Throwable {
- final AtomicReference<Throwable> ex = new AtomicReference<>();
-
- Thread runner = new IgniteThread("srv0", "test-runner", new Runnable() {
- @Override public void run() {
- try {
- scriptRunner.run();
- }
- catch (Throwable e) {
- ex.set(e);
- }
- }
- });
-
- runner.start();
-
- runner.join(timeout);
-
- if (runner.isAlive()) {
- U.error(log,
- "Test has been timed out and will be interrupted");
-
- List<Ignite> nodes = IgnitionEx.allGridsx();
-
- for (Ignite node : nodes)
- ((IgniteKernal)node).dumpDebugInfo();
-
- // We dump threads to stdout, because we can loose logs in case
- // the build is cancelled on TeamCity.
- U.dumpThreads(null);
-
- U.dumpThreads(log);
-
- // Try to interrupt runner several times for case when InterruptedException is handled invalid.
- for (int i = 0; i < 100 && runner.isAlive(); ++i) {
- U.interrupt(runner);
-
- U.sleep(10);
- }
-
- U.join(runner, log);
-
- // Restart cluster
- Ignition.stopAll(true);
- startCluster();
-
- throw new TimeoutException("Test has been timed out");
- }
-
- Throwable t = ex.get();
-
- if (t != null)
- throw t;
- }
-}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteMessageUnmarshalThreadIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteMessageUnmarshalThreadIntegrationTest.java
index 4b5493be2be..ca3aec83c26 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteMessageUnmarshalThreadIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/message/CalciteMessageUnmarshalThreadIntegrationTest.java
@@ -26,7 +26,7 @@ import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.apache.ignite.internal.processors.query.calcite.exec.task.AbstractQueryTaskExecutor;
import org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Verifies that payload of calcite messages is unmarshalled on the query task executor, not on a NIO thread: probe
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java
index 6c29252f6bd..797c1169e84 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java
@@ -55,6 +55,7 @@ import org.apache.ignite.failure.FailureContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.failure.FailureProcessor;
import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
import org.apache.ignite.internal.processors.query.calcite.exec.task.StripedQueryTaskExecutor;
import org.apache.ignite.internal.processors.query.calcite.externalize.RelJsonReader;
@@ -81,12 +82,10 @@ import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.junit.After;
-import org.junit.Before;
-
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import static org.apache.calcite.tools.Frameworks.createRootSchema;
import static org.apache.ignite.internal.processors.query.calcite.externalize.RelJsonWriter.toJson;
@@ -95,7 +94,7 @@ import static org.apache.ignite.internal.processors.query.calcite.externalize.Re
*/
//@WithSystemProperty(key = "calcite.debug", value = "true")
@SuppressWarnings({"TooBroadScope", "FieldCanBeLocal", "TypeMayBeWeakened"})
-public abstract class AbstractPlannerTest extends GridCommonAbstractTest {
+public abstract class AbstractPlannerTest extends GridCommonAbstractWrapperTest {
/** */
private static final RelDataTypeSystem TYPE_SYSTEM = CalciteQueryProcessor.FRAMEWORK_CONFIG.getTypeSystem();
@@ -124,7 +123,7 @@ public abstract class AbstractPlannerTest extends GridCommonAbstractTest {
protected ListeningTestLogger lsnrLog = new ListeningTestLogger(log);
/** */
- @Before
+ @BeforeEach
public void setup() {
nodes = new ArrayList<>(4);
@@ -133,7 +132,7 @@ public abstract class AbstractPlannerTest extends GridCommonAbstractTest {
}
/** */
- @After
+ @AfterEach
public void tearDown() throws Throwable {
if (!F.isEmpty(executors))
executors.forEach(StripedQueryTaskExecutor::tearDown);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerUtilityTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerUtilityTest.java
index 303591fdb4f..20b24d3bd2c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerUtilityTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerUtilityTest.java
@@ -37,8 +37,7 @@ import org.apache.ignite.internal.processors.query.calcite.rel.IgniteIndexScan;
import org.apache.ignite.internal.processors.query.calcite.rel.ProjectableFilterableTableScan;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock;
/** {@link AbstractPlannerTest} inner utility methods test. */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregateDistinctPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregateDistinctPlannerTest.java
index 410207ebe8b..11252a7cf42 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregateDistinctPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregateDistinctPlannerTest.java
@@ -36,24 +36,25 @@ import org.apache.ignite.internal.processors.query.calcite.rel.agg.IgniteReduceH
import org.apache.ignite.internal.processors.query.calcite.rel.agg.IgniteReduceSortAggregate;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
*
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "Algorithm = {0}")
+@MethodSource("parameters")
public class AggregateDistinctPlannerTest extends AbstractAggregatePlannerTest {
/** Algorithm. */
- @Parameterized.Parameter
+ @Parameter
public AggregateAlgorithm algo;
/** */
- @Parameterized.Parameters(name = "Algorithm = {0}")
- public static List<Object[]> parameters() {
- return Stream.of(AggregateAlgorithm.values()).map(a -> new Object[]{a}).collect(Collectors.toList());
+ private static List<Arguments> parameters() {
+ return Stream.of(AggregateAlgorithm.values()).map(Arguments::of).collect(Collectors.toList());
}
/**
@@ -84,11 +85,11 @@ public class AggregateDistinctPlannerTest extends AbstractAggregatePlannerTest {
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys, SqlExplainLevel.ALL_ATTRIBUTES), rdcAgg);
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), mapAgg);
- Assert.assertTrue(
+ assertTrue(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.isEmpty(rdcAgg.getAggregateCalls()));
- Assert.assertTrue(
+ assertTrue(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.isEmpty(mapAgg.getAggCallList()));
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java
index 19395f014c4..9cd942a2229 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java
@@ -48,24 +48,27 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.trait.TraitUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.hamcrest.MatcherAssert.assertThat;
/**
*
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "Algorithm = {0}")
+@MethodSource("parameters")
public class AggregatePlannerTest extends AbstractAggregatePlannerTest {
/** Algorithm. */
- @Parameterized.Parameter
+ @Parameter
public AggregateAlgorithm algo;
/** */
- @Parameterized.Parameters(name = "Algorithm = {0}")
- public static List<Object[]> parameters() {
- return Stream.of(AggregateAlgorithm.values()).map(a -> new Object[]{a}).collect(Collectors.toList());
+ private static List<Arguments> parameters() {
+ return Stream.of(AggregateAlgorithm.values()).map(Arguments::of).collect(Collectors.toList());
}
/**
@@ -93,7 +96,7 @@ public class AggregatePlannerTest extends AbstractAggregatePlannerTest {
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), agg);
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(agg.getAggCallList()).getAggregation(),
IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
@@ -127,7 +130,7 @@ public class AggregatePlannerTest extends AbstractAggregatePlannerTest {
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), agg);
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(agg.getAggCallList()).getAggregation(),
IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
@@ -163,12 +166,12 @@ public class AggregatePlannerTest extends AbstractAggregatePlannerTest {
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys, SqlExplainLevel.ALL_ATTRIBUTES), rdcAgg);
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), mapAgg);
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(rdcAgg.getAggregateCalls()).getAggregation(),
IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(mapAgg.getAggCallList()).getAggregation(),
IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedNestedLoopJoinPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedNestedLoopJoinPlannerTest.java
index 55ad49ace4c..5429d67598b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedNestedLoopJoinPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedNestedLoopJoinPlannerTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.query.calcite.planner;
import java.util.List;
import java.util.function.Predicate;
-
import org.apache.calcite.plan.RelOptUtil;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.core.JoinRelType;
@@ -33,8 +32,7 @@ import org.apache.ignite.internal.processors.query.calcite.rel.IgniteIndexScan;
import org.apache.ignite.internal.processors.query.calcite.rel.IgniteRel;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
import static org.apache.calcite.sql.type.SqlTypeName.VARCHAR;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java
index 202bdef4aa0..11c36e47e47 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java
@@ -50,7 +50,7 @@ import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.util.RexUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/** Tests to verify correlated subquery planning. */
public class CorrelatedSubqueryPlannerTest extends AbstractPlannerTest {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DataTypesPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DataTypesPlannerTest.java
index 140665b4ca4..57a5da6d38b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DataTypesPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DataTypesPlannerTest.java
@@ -34,7 +34,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Planner test various types, casts and coercions.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DynamicParametersPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DynamicParametersPlannerTest.java
index e27d9eb468c..f797d456f35 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DynamicParametersPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DynamicParametersPlannerTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.query.calcite.planner;
import java.math.BigInteger;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions.single;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashAggregatePlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashAggregatePlannerTest.java
index bb629b2e5d2..f6d9d9f5e02 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashAggregatePlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashAggregatePlannerTest.java
@@ -42,10 +42,10 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
import org.apache.ignite.internal.util.typedef.F;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.trait.TraitUtils.createFieldCollation;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
*
@@ -245,12 +245,12 @@ public class HashAggregatePlannerTest extends AbstractAggregatePlannerTest {
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), rdcAgg);
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), mapAgg);
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(rdcAgg.getAggregateCalls()).getAggregation(),
IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(mapAgg.getAggCallList()).getAggregation(),
IsInstanceOf.instanceOf(SqlAvgAggFunction.class));
@@ -282,12 +282,12 @@ public class HashAggregatePlannerTest extends AbstractAggregatePlannerTest {
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), rdcAgg);
assertNotNull("Invalid plan\n" + RelOptUtil.toString(phys), mapAgg);
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(rdcAgg.getAggregateCalls()).getAggregation(),
IsInstanceOf.instanceOf(SqlCountAggFunction.class));
- Assert.assertThat(
+ assertThat(
"Invalid plan\n" + RelOptUtil.toString(phys),
F.first(mapAgg.getAggCallList()).getAggregation(),
IsInstanceOf.instanceOf(SqlCountAggFunction.class));
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashIndexSpoolPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashIndexSpoolPlannerTest.java
index 44b05e24335..28951ce65af 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashIndexSpoolPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashIndexSpoolPlannerTest.java
@@ -31,7 +31,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashJoinPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashJoinPlannerTest.java
index 55140639755..1acdbe25105 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashJoinPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/HashJoinPlannerTest.java
@@ -29,7 +29,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.rel.RelFieldCollation.Direction.ASCENDING;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexRebuildPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexRebuildPlannerTest.java
index 14c100a8871..333f0e75c8b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexRebuildPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexRebuildPlannerTest.java
@@ -30,8 +30,8 @@ import org.apache.ignite.internal.processors.query.calcite.rel.agg.IgniteColocat
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
-
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.SqlKind.COUNT;
import static org.apache.calcite.sql.SqlKind.MAX;
import static org.apache.calcite.sql.SqlKind.MIN;
@@ -48,6 +48,7 @@ public class IndexRebuildPlannerTest extends AbstractPlannerTest {
private TestTable tbl;
/** {@inheritDoc} */
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexSearchBoundsPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexSearchBoundsPlannerTest.java
index 3311a8361e0..96e4561fa9e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexSearchBoundsPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/IndexSearchBoundsPlannerTest.java
@@ -39,7 +39,8 @@ import org.apache.ignite.internal.processors.query.calcite.trait.TraitUtils;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
import org.apache.ignite.internal.processors.query.calcite.util.RexUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Planner test for indexed fields scans.
@@ -52,6 +53,7 @@ public class IndexSearchBoundsPlannerTest extends AbstractPlannerTest {
private TestTable tbl;
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
IgniteTypeFactory f = new IgniteTypeFactory(IgniteTypeSystem.INSTANCE);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/InlineIndexScanPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/InlineIndexScanPlannerTest.java
index a434da809e4..b0fe07aa981 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/InlineIndexScanPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/InlineIndexScanPlannerTest.java
@@ -22,7 +22,7 @@ import java.util.UUID;
import org.apache.ignite.internal.processors.query.calcite.rel.AbstractIndexScan;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Planner test for index inline scan.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinColocationPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinColocationPlannerTest.java
index 0b06c0ddd75..b194a7836d7 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinColocationPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinColocationPlannerTest.java
@@ -31,11 +31,11 @@ import org.apache.ignite.internal.processors.query.calcite.rel.agg.IgniteColocat
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Test suite to verify join colocation.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinCommutePlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinCommutePlannerTest.java
index 8e704c047c5..0342f38fcd4 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinCommutePlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinCommutePlannerTest.java
@@ -42,7 +42,8 @@ import org.apache.ignite.internal.processors.query.calcite.rule.logical.IgniteMu
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribution;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/** Tests correctness applying of JOIN_COMMUTE* and {@link IgniteMultiJoinOptimizeRule} rules. */
public class JoinCommutePlannerTest extends AbstractPlannerTest {
@@ -50,6 +51,7 @@ public class JoinCommutePlannerTest extends AbstractPlannerTest {
private static IgniteSchema publicSchema;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinWithUsingPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinWithUsingPlannerTest.java
index 66683b75539..ae9c89feda2 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinWithUsingPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinWithUsingPlannerTest.java
@@ -26,8 +26,8 @@ import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests for JOIN with USING and NATURAL JOIN.
@@ -37,7 +37,7 @@ public class JoinWithUsingPlannerTest extends AbstractPlannerTest {
private final Collection<IgniteSchema> schemas = new ArrayList<>();
/** {@inheritDoc} */
- @Before
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/LimitOffsetPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/LimitOffsetPlannerTest.java
index 98a91eb61de..c6a27eb5485 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/LimitOffsetPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/LimitOffsetPlannerTest.java
@@ -41,7 +41,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.util.RexUtils.doubleFromRex;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/MergeJoinPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/MergeJoinPlannerTest.java
index c15009fca33..c49cd50c27a 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/MergeJoinPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/MergeJoinPlannerTest.java
@@ -30,8 +30,7 @@ import org.apache.ignite.internal.processors.query.calcite.rel.IgniteTableScan;
import org.apache.ignite.internal.processors.query.calcite.rel.ProjectableFilterableTableScan;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.rel.RelFieldCollation.Direction.ASCENDING;
import static org.apache.calcite.rel.RelFieldCollation.Direction.DESCENDING;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java
index 45d63096530..bd102cf2bc7 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanExecutionTest.java
@@ -67,11 +67,12 @@ import org.apache.ignite.internal.thread.pool.IgniteStripedThreadPoolExecutor;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.tools.Frameworks.createRootSchema;
import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
/**
*
@@ -79,6 +80,7 @@ import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KE
@SuppressWarnings({"TooBroadScope", "FieldCanBeLocal", "TypeMayBeWeakened"})
public class PlanExecutionTest extends AbstractPlannerTest {
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -165,8 +167,8 @@ public class PlanExecutionTest extends AbstractPlannerTest {
assertFalse(res.isEmpty());
- Assert.assertArrayEquals(new Object[]{0, "Igor", 0, "Calcite", 1}, res.get(0));
- Assert.assertArrayEquals(new Object[]{1, "Roman", 0, "Calcite", 1}, res.get(1));
+ assertArrayEquals(new Object[]{0, "Igor", 0, "Calcite", 1}, res.get(0));
+ assertArrayEquals(new Object[]{1, "Roman", 0, "Calcite", 1}, res.get(1));
}
/**
@@ -227,7 +229,7 @@ public class PlanExecutionTest extends AbstractPlannerTest {
int pos = 0;
for (Object obj : checkRes.get())
- Assert.assertArrayEquals((Object[])obj, res.get(pos++));
+ assertArrayEquals((Object[])obj, res.get(pos++));
}
/** */
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java
index 72cf2738a51..44438554d2b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java
@@ -34,8 +34,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
import static org.apache.calcite.sql.type.SqlTypeName.VARCHAR;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlannerTimeoutTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlannerTimeoutTest.java
index 408926bb53c..39904981056 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlannerTimeoutTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlannerTimeoutTest.java
@@ -33,13 +33,25 @@ import org.apache.ignite.internal.processors.query.calcite.schema.CacheIndexImpl
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.trait.TraitUtils;
+import org.apache.ignite.internal.util.CommonUtils;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
/**
* Test planner timeout.
*/
+@Order(1)
public class PlannerTimeoutTest extends AbstractPlannerTest {
+ /** */
+ @BeforeAll
+ static void init() {
+ // Additional check for val correctness: GridTestClockTimer#startTestTimer
+ // Extended description: https://issues.apache.org/jira/browse/IGNITE-29084
+ assertEquals(1, (int)GridTestUtils.getFieldValue(CommonUtils.class, "gridCnt"));
+ }
+
/** */
private static final long PLANNER_TIMEOUT = 1_000;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/ProjectFilterScanMergePlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/ProjectFilterScanMergePlannerTest.java
index 95b0b3c2700..1e672ccd531 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/ProjectFilterScanMergePlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/ProjectFilterScanMergePlannerTest.java
@@ -28,8 +28,8 @@ import org.apache.ignite.internal.processors.query.calcite.rel.IgniteIndexScan;
import org.apache.ignite.internal.processors.query.calcite.rel.IgniteTableScan;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
@@ -41,7 +41,7 @@ public class ProjectFilterScanMergePlannerTest extends AbstractPlannerTest {
private IgniteSchema publicSchema;
/** {@inheritDoc} */
- @Before
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RecursiveCtePlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RecursiveCtePlannerTest.java
index d1700071af1..1c5e557a1fe 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RecursiveCtePlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RecursiveCtePlannerTest.java
@@ -42,7 +42,7 @@ import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribution;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/** Planner tests for recursive common table expressions. */
public class RecursiveCtePlannerTest extends AbstractPlannerTest {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RexSimplificationPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RexSimplificationPlannerTest.java
index 49ea85823e9..14e72023230 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RexSimplificationPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/RexSimplificationPlannerTest.java
@@ -35,8 +35,7 @@ import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.processors.query.calcite.util.RexUtils;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
import static org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions.single;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SerializationPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SerializationPlannerTest.java
index bc2ff7e89fe..11eb9a7e077 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SerializationPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SerializationPlannerTest.java
@@ -25,8 +25,7 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.IgniteScalar
import org.apache.ignite.internal.processors.query.calcite.rel.IgniteRel;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions.single;
/**
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SetOpPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SetOpPlannerTest.java
index 55b52240b44..e8324816048 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SetOpPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SetOpPlannerTest.java
@@ -20,8 +20,6 @@ package org.apache.ignite.internal.processors.query.calcite.planner;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.rel.IgniteExchange;
@@ -40,31 +38,27 @@ import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.EnumSource;
/**
* Test to verify set op (EXCEPT, INTERSECT).
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "SetOp = {0}")
+@EnumSource(value = SetOpPlannerTest.SetOp.class)
public class SetOpPlannerTest extends AbstractPlannerTest {
/** Algorithm. */
- @Parameterized.Parameter
+ @Parameter
public SetOp setOp;
- /** */
- @Parameterized.Parameters(name = "SetOp = {0}")
- public static List<Object[]> parameters() {
- return Stream.of(SetOp.values()).map(a -> new Object[]{a}).collect(Collectors.toList());
- }
-
/** Public schema. */
private IgniteSchema publicSchema;
/** {@inheritDoc} */
- @Before
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortAggregatePlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortAggregatePlannerTest.java
index 2f0e13cc24c..4dfbddba673 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortAggregatePlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortAggregatePlannerTest.java
@@ -45,8 +45,7 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
import static org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions.random;
import static org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions.single;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortedIndexSpoolPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortedIndexSpoolPlannerTest.java
index 63ed1c6a8d6..eef82676ef0 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortedIndexSpoolPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/SortedIndexSpoolPlannerTest.java
@@ -35,8 +35,8 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.trait.TraitUtils;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
/**
*
@@ -229,7 +229,7 @@ public class SortedIndexSpoolPlannerTest extends AbstractPlannerTest {
* Check sorted spool without input collation.
*/
@Test
- @Ignore("https://issues.apache.org/jira/browse/IGNITE-16430")
+ @Disabled("https://issues.apache.org/jira/browse/IGNITE-16430")
public void testRestoreCollation() throws Exception {
IgniteSchema publicSchema = createSchema(
createTable("T0", 100, IgniteDistributions.random(),
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/StatisticsPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/StatisticsPlannerTest.java
index 59409e1be0e..ad330d84900 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/StatisticsPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/StatisticsPlannerTest.java
@@ -37,8 +37,8 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
import org.apache.ignite.internal.processors.query.stat.ColumnStatistics;
import org.apache.ignite.internal.processors.query.stat.ObjectStatisticsImpl;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.stat.StatisticsUtils.toDecimal;
@@ -86,7 +86,7 @@ public class StatisticsPlannerTest extends AbstractPlannerTest {
private IgniteStatisticsImpl tbl1stat;
/** {@inheritDoc} */
- @Before
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableDmlPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableDmlPlannerTest.java
index 1694b8d7773..864512dfe54 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableDmlPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableDmlPlannerTest.java
@@ -32,7 +32,7 @@ import org.apache.ignite.internal.processors.query.calcite.rule.TableModifySingl
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
import static org.apache.calcite.sql.type.SqlTypeName.OTHER;
@@ -41,7 +41,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Table spool test.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableFunctionPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableFunctionPlannerTest.java
index 227a95b5a2c..7f49d1558eb 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableFunctionPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableFunctionPlannerTest.java
@@ -27,8 +27,8 @@ import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Test table functions.
@@ -39,7 +39,7 @@ public class TableFunctionPlannerTest extends AbstractPlannerTest {
/** {@inheritDoc} */
- @Before
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableSpoolPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableSpoolPlannerTest.java
index 04eeb95cc85..9cb0e42400a 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableSpoolPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/TableSpoolPlannerTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Table spool test.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java
index 435d4d41607..ee38c3d6829 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java
@@ -27,8 +27,8 @@ import org.apache.ignite.internal.processors.query.calcite.rel.IgniteTrimExchang
import org.apache.ignite.internal.processors.query.calcite.rel.IgniteUncollect;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions.broadcast;
import static org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions.single;
@@ -41,7 +41,7 @@ public class UncollectPlannerTest extends AbstractPlannerTest {
private IgniteSchema publicSchema;
/** {@inheritDoc} */
- @Before
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UnionPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UnionPlannerTest.java
index 19eddfe5ce0..667a99b89d6 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UnionPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UnionPlannerTest.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.query.calcite.planner;
import java.util.Arrays;
-
import org.apache.calcite.rel.core.Union;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.metadata.ColocationGroup;
@@ -30,7 +29,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
*
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UserDefinedViewsPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UserDefinedViewsPlannerTest.java
index 9976074e86c..67b3717091d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UserDefinedViewsPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UserDefinedViewsPlannerTest.java
@@ -23,7 +23,7 @@ import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema;
import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.apache.calcite.sql.type.SqlTypeName.INTEGER;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/WindowPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/WindowPlannerTest.java
index c38512955f0..9ee548cf13f 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/WindowPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/WindowPlannerTest.java
@@ -45,7 +45,7 @@ import org.apache.ignite.internal.processors.query.calcite.trait.TraitUtils;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.internal.util.typedef.F;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static java.util.function.Predicate.not;
import static org.apache.calcite.rex.RexWindowBounds.CURRENT_ROW;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/CommonHintsPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/CommonHintsPlannerTest.java
index e268f61fb94..728d521c3bb 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/CommonHintsPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/CommonHintsPlannerTest.java
@@ -26,7 +26,9 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.testframework.LogListener;
import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
import org.apache.logging.log4j.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Common test for SQL hints.
@@ -39,6 +41,7 @@ public class CommonHintsPlannerTest extends AbstractPlannerTest {
private TestTable tbl;
/** {@inheritDoc} */
+ @BeforeEach
@Override public void setup() {
super.setup();
@@ -49,6 +52,7 @@ public class CommonHintsPlannerTest extends AbstractPlannerTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/ForceIndexHintPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/ForceIndexHintPlannerTest.java
index fa88732a1b6..904cb9a9a82 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/ForceIndexHintPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/ForceIndexHintPlannerTest.java
@@ -25,7 +25,9 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.testframework.LogListener;
import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
import org.apache.logging.log4j.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Planner test for force index hint.
@@ -41,6 +43,7 @@ public class ForceIndexHintPlannerTest extends AbstractPlannerTest {
private TestTable tbl2;
/** {@inheritDoc} */
+ @BeforeEach
@Override public void setup() {
super.setup();
@@ -64,6 +67,7 @@ public class ForceIndexHintPlannerTest extends AbstractPlannerTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/HintsTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/HintsTestSuite.java
index aaddbc3d953..946d238b590 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/HintsTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/HintsTestSuite.java
@@ -17,14 +17,14 @@
package org.apache.ignite.internal.processors.query.calcite.planner.hints;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* SQL hints tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
CommonHintsPlannerTest.class,
NoIndexHintPlannerTest.class,
ForceIndexHintPlannerTest.class,
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinOrderHintsPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinOrderHintsPlannerTest.java
index 18971d79faf..c807e0b2a54 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinOrderHintsPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinOrderHintsPlannerTest.java
@@ -30,7 +30,9 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.LogListener;
import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
import org.apache.logging.log4j.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Planner test for join order hints.
@@ -40,6 +42,7 @@ public class JoinOrderHintsPlannerTest extends AbstractPlannerTest {
private IgniteSchema schema;
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
@@ -47,6 +50,7 @@ public class JoinOrderHintsPlannerTest extends AbstractPlannerTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java
index 692e3a9f6bd..1465b6c38e3 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java
@@ -41,8 +41,9 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.testframework.LogListener;
import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
import org.apache.logging.log4j.Level;
-import org.junit.Test;
-
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition.CNL_JOIN;
import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition.HASH_JOIN;
import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition.MERGE_JOIN;
@@ -67,6 +68,7 @@ public class JoinTypeHintPlannerTest extends AbstractPlannerTest {
private IgniteSchema schema;
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
@@ -74,6 +76,7 @@ public class JoinTypeHintPlannerTest extends AbstractPlannerTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override public void setup() {
super.setup();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/NoIndexHintPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/NoIndexHintPlannerTest.java
index e79a766f7a5..36daf8b11bc 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/NoIndexHintPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/NoIndexHintPlannerTest.java
@@ -26,7 +26,9 @@ import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistribut
import org.apache.ignite.testframework.LogListener;
import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
import org.apache.logging.log4j.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Planner test for index hints.
@@ -42,6 +44,7 @@ public class NoIndexHintPlannerTest extends AbstractPlannerTest {
private TestTable tbl2;
/** {@inheritDoc} */
+ @BeforeEach
@Override public void setup() {
super.setup();
@@ -63,6 +66,7 @@ public class NoIndexHintPlannerTest extends AbstractPlannerTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java
index 70125f6d4e8..8751cf718ed 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java
@@ -25,26 +25,29 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.Collection;
import java.util.Comparator;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
+import java.util.stream.Stream;
import com.google.common.io.CharStreams;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests ensures a planner generates optimal plan for TPC-H queries.
*
* @code org.apache.ignite.internal.sql.engine.benchmarks.TpchParseBenchmark
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "queryId={0}")
+@MethodSource("parameters")
public class TpchQueryPlannerTest extends AbstractBasicIntegrationTest {
/** Set to {@code true} to write plan files, instead of checking. */
private static final boolean UPDATE_PLAN = false;
@@ -62,18 +65,17 @@ public class TpchQueryPlannerTest extends AbstractBasicIntegrationTest {
public static final String RSRC_DIR = "modules/calcite/src/test/resources/" + TPCH;
/** */
- @Parameterized.Parameters(name = "queryId={0}")
- public static Collection<String> params() throws IOException {
+ public static Stream<Arguments> parameters() throws IOException {
return Files.list(FileSystems.getDefault().getPath(U.resolveIgnitePath(RSRC_DIR).getPath()))
.map(p -> p.getFileName().toString())
.filter(p -> p.endsWith(".sql") && !p.endsWith("ddl.sql"))
.map(p -> p.replace(".sql", ""))
.sorted(Comparator.comparingInt(p -> Integer.parseInt(p.replace("variant_q", "").replace("q", ""))))
- .collect(Collectors.toList());
+ .map(Arguments::of);
}
/** Query id. */
- @Parameterized.Parameter
+ @Parameter
public String qryId;
/** {@inheritDoc} */
@@ -86,6 +88,7 @@ public class TpchQueryPlannerTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinCommuteRulesTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinCommuteRulesTest.java
index 8292f99749d..e418524e8e4 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinCommuteRulesTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinCommuteRulesTest.java
@@ -21,19 +21,21 @@ import java.util.List;
import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.query.QueryEngine;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsSubPlan;
import static org.apache.ignite.internal.processors.query.calcite.QueryChecker.containsTableScan;
/** Tests correctness applying of JOIN_COMMUTE* rules. */
-public class JoinCommuteRulesTest extends GridCommonAbstractTest {
+public class JoinCommuteRulesTest extends GridCommonAbstractWrapperTest {
/** */
private static QueryEngine qryEngine;
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
startGridsMultiThreaded(2);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinOrderOptimizationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinOrderOptimizationTest.java
index c5396eb3767..90b69cf8b46 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinOrderOptimizationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/JoinOrderOptimizationTest.java
@@ -20,16 +20,19 @@ package org.apache.ignite.internal.processors.query.calcite.rules;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.stream.Collectors;
import org.apache.calcite.rel.rules.JoinToMultiJoinRule;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.RuleApplyListener;
import org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
import org.apache.ignite.internal.processors.query.calcite.rule.logical.IgniteMultiJoinOptimizeRule;
import org.apache.ignite.internal.util.typedef.F;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition.ENFORCE_JOIN_ORDER;
/**
@@ -38,19 +41,22 @@ import static org.apache.ignite.internal.processors.query.calcite.hint.HintDefin
* @see JoinToMultiJoinRule
* @see IgniteMultiJoinOptimizeRule
*/
-@RunWith(Parameterized.class)
+@ParameterizedClass
+@MethodSource("runConfig")
public class JoinOrderOptimizationTest extends AbstractBasicIntegrationTest {
/** Test query. */
- @Parameterized.Parameter
+ @Parameter
public String qry;
/** Test queries. */
- @Parameterized.Parameters
- public static Collection<String> runConfig() {
- return testQueries();
+ private static Collection<Arguments> runConfig() {
+ return testQueries().stream()
+ .map(Arguments::of)
+ .collect(Collectors.toList());
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/OrToUnionRuleTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/OrToUnionRuleTest.java
index 926d288a384..64e9a55cd4e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/OrToUnionRuleTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/OrToUnionRuleTest.java
@@ -25,11 +25,12 @@ import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cache.QueryIndexType;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.query.QueryEngine;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.hamcrest.CoreMatchers;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
@@ -53,7 +54,7 @@ import static org.hamcrest.CoreMatchers.not;
* SELECT * FROM products
* WHERE subcategory ='Camera Media' AND LNNVL(category, 'Photo');
*/
-public class OrToUnionRuleTest extends GridCommonAbstractTest {
+public class OrToUnionRuleTest extends GridCommonAbstractWrapperTest {
/** */
public static final String IDX_SUBCAT_ID = "IDX_SUBCAT_ID";
@@ -67,6 +68,7 @@ public class OrToUnionRuleTest extends GridCommonAbstractTest {
public static final String IDX_CAT_ID = "IDX_CAT_ID";
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
Ignite grid = startGridsMultiThreaded(2);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/ProjectScanMergeRuleTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/ProjectScanMergeRuleTest.java
index 8dae4da851a..59241cb8469 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/ProjectScanMergeRuleTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/rules/ProjectScanMergeRuleTest.java
@@ -25,11 +25,12 @@ import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cache.QueryIndexType;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.query.QueryEngine;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
@@ -46,11 +47,12 @@ import static org.apache.ignite.internal.processors.query.calcite.rules.OrToUnio
* sql execution: SELECT t1.f11, t2.f21 FROM T1 t1 INNER JOIN T2 t2 on t1.f11 = t2.f22"
* need to eleminate all unused coluns and take into account only: f11, f21 and f22 cols.
*/
-public class ProjectScanMergeRuleTest extends GridCommonAbstractTest {
+public class ProjectScanMergeRuleTest extends GridCommonAbstractWrapperTest {
/** */
public static final String IDX_CAT_ID = "IDX_CAT_ID";
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
Ignite grid = startGridsMultiThreaded(2);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/ParserCodegenResourcesTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/ParserCodegenResourcesTest.java
index eb34431d777..80f22d66064 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/ParserCodegenResourcesTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/ParserCodegenResourcesTest.java
@@ -18,14 +18,15 @@
package org.apache.ignite.internal.processors.query.calcite.sql;
import org.apache.ignite.internal.processors.query.calcite.sql.generated.IgniteSqlParserImpl;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertNotNull;
/** Verifies that parser code generation inputs are published as module resources. */
public class ParserCodegenResourcesTest {
/** Verifies resources required to extend the Ignite SQL grammar. */
- @Test public void testParserCodegenResourcesAvailable() {
+ @Test
+ public void testParserCodegenResourcesAvailable() {
assertResourceAvailable("/codegen/config.fmpp");
assertResourceAvailable("/codegen/includes/parserImpls.ftl");
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlCustomParserTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlCustomParserTest.java
index 165c5c2804e..3af3b901938 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlCustomParserTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlCustomParserTest.java
@@ -41,6 +41,7 @@ import org.apache.calcite.sql.ddl.SqlKeyConstraint;
import org.apache.calcite.sql.parser.SqlParseException;
import org.apache.calcite.sql.parser.SqlParser;
import org.apache.calcite.sql.validate.SqlValidatorException;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.sql.generated.IgniteSqlParserImpl;
import org.apache.ignite.internal.processors.query.calcite.sql.kill.IgniteSqlKillComputeTask;
import org.apache.ignite.internal.processors.query.calcite.sql.kill.IgniteSqlKillContinuousQuery;
@@ -55,12 +56,10 @@ import org.apache.ignite.internal.processors.query.calcite.sql.stat.IgniteSqlSta
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.hamcrest.CustomMatcher;
import org.hamcrest.Matcher;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static java.util.Collections.singleton;
import static org.apache.ignite.internal.processors.query.calcite.sql.stat.IgniteSqlStatisticsAnalyzeOptionEnum.DISTINCT;
import static org.apache.ignite.internal.processors.query.calcite.sql.stat.IgniteSqlStatisticsAnalyzeOptionEnum.MAX_CHANGED_PARTITION_ROWS_PERCENT;
@@ -72,12 +71,12 @@ import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
/**
* Test suite to verify parsing of the custom (DDL and others) command.
*/
-public class SqlCustomParserTest extends GridCommonAbstractTest {
+public class SqlCustomParserTest extends GridCommonAbstractWrapperTest {
/**
* Very simple case where only table name and a few columns are presented.
*/
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlReservedWordsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlReservedWordsTest.java
index 4137028bf79..daaeb50f91e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlReservedWordsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlReservedWordsTest.java
@@ -22,14 +22,14 @@ import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
import org.apache.calcite.sql.parser.SqlAbstractParserImpl;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.processors.query.calcite.sql.generated.IgniteSqlParserImpl;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Test reserved keywords.
*/
-public class SqlReservedWordsTest extends GridCommonAbstractTest {
+public class SqlReservedWordsTest extends GridCommonAbstractWrapperTest {
/** List of keywords reserved in Ignite SQL. */
private static final Set<String> RESERVED_WORDS = new HashSet<>(Arrays.asList(
"ALL", // UNION ALL
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlSelectForUpdateParserTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlSelectForUpdateParserTest.java
index 9ddf12ab277..2d94f80ecea 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlSelectForUpdateParserTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlSelectForUpdateParserTest.java
@@ -27,7 +27,7 @@ import org.apache.calcite.sql.parser.SqlParser;
import org.apache.ignite.internal.processors.query.calcite.sql.generated.IgniteSqlParserImpl;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/thin/MultiLineQueryTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/thin/MultiLineQueryTest.java
index 5af3d58e7fc..145324f6b8e 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/thin/MultiLineQueryTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/thin/MultiLineQueryTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.ignite.internal.processors.query.calcite.thin;
+import java.util.Collection;
import java.util.List;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
@@ -26,19 +27,22 @@ import org.apache.ignite.configuration.ClientConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.SqlConfiguration;
import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
/**
* Tests proper exception is thrown when multiline expressions are executed on thin client on both engines.
*/
-@RunWith(Parameterized.class)
-public class MultiLineQueryTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "engine={0}")
+@MethodSource("parameters")
+public class MultiLineQueryTest extends GridCommonAbstractWrapperTest {
/** */
private static final String H2_ENGINE = IndexingQueryEngineConfiguration.ENGINE_NAME;
@@ -49,13 +53,15 @@ public class MultiLineQueryTest extends GridCommonAbstractTest {
private IgniteClient cli;
/** */
- @Parameterized.Parameter
+ @Parameter
public String queryEngine;
/** */
- @Parameterized.Parameters(name = "engine={0}")
- public static List<Object> parameters() {
- return F.asList(H2_ENGINE, CALCITE_ENGINE);
+ private static Collection<Arguments> parameters() {
+ return List.of(
+ Arguments.of(H2_ENGINE),
+ Arguments.of(CALCITE_ENGINE)
+ );
}
/** {@inheritDoc} */
@@ -69,6 +75,7 @@ public class MultiLineQueryTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -80,6 +87,7 @@ public class MultiLineQueryTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
if (cli != null) {
cli.close();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/type/OtherTypeTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/type/OtherTypeTest.java
index 0ce072253e1..2455e160f44 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/type/OtherTypeTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/type/OtherTypeTest.java
@@ -21,7 +21,7 @@ import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.sql.type.BasicSqlType;
import org.apache.calcite.sql.type.SqlTypeName;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtilsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtilsTest.java
index 635df8da510..79507823be0 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtilsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtilsTest.java
@@ -34,7 +34,7 @@ import org.apache.calcite.DataContexts;
import org.apache.calcite.util.DateString;
import org.apache.calcite.util.TimeString;
import org.apache.calcite.util.TimestampString;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/AbstractQueryTransactionIsolationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/AbstractQueryTransactionIsolationTest.java
new file mode 100644
index 00000000000..8a833f5c7be
--- /dev/null
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/AbstractQueryTransactionIsolationTest.java
@@ -0,0 +1,707 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.tx;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.client.ClientTransaction;
+import org.apache.ignite.client.Config;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.odbc.ClientMessage;
+import org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext;
+import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
+import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
+import org.apache.ignite.internal.util.lang.RunnableX;
+import org.apache.ignite.internal.util.nio.GridNioServer;
+import org.apache.ignite.internal.util.nio.GridNioSession;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+
+import static org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.CONN_CTX_META_KEY;
+import static org.apache.ignite.internal.processors.tx.AbstractQueryTransactionIsolationTest.ModifyApi.CACHE;
+import static org.apache.ignite.internal.processors.tx.AbstractQueryTransactionIsolationTest.ModifyApi.ENTRY_PROCESSOR;
+import static org.apache.ignite.internal.processors.tx.AbstractQueryTransactionIsolationTest.ModifyApi.QUERY;
+import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
+
+/** Copy paste from code module with removed legacy junit stuff. */
+public abstract class AbstractQueryTransactionIsolationTest extends GridCommonAbstractWrapperTest {
+ /** */
+ public static final String USERS = "USERS";
+
+ /** */
+ public static final int TX_TIMEOUT = 60_000;
+
+ /** */
+ public static final int TX_SIZE = 10;
+
+ /** */
+ public static final User JOHN = new User(1, 0, "John Connor");
+
+ /** */
+ public static final User SARAH = new User(2, 0, "Sarah Connor");
+
+ /** */
+ public static final User KYLE = new User(3, 0, "Kyle Reese");
+
+ /** */
+ @Parameter(0)
+ public int gridCnt;
+
+ /** */
+ @Parameter(1)
+ public int backups;
+
+ /** */
+ @Parameter(2)
+ public boolean partitionAwareness;
+
+ /** */
+ @Parameter(3)
+ public CacheMode mode;
+
+ /** */
+ @Parameter(4)
+ public ExecutorType type;
+
+ /** */
+ @Parameter(5)
+ public ModifyApi modify;
+
+ /** */
+ @Parameter(6)
+ public boolean commit;
+
+ /** */
+ @Parameter(7)
+ public boolean multi;
+
+ /** */
+ @Parameter(8)
+ public TransactionConcurrency txConcurrency;
+
+ /** */
+ protected static IgniteEx srv;
+
+ /** */
+ protected static IgniteEx cli;
+
+ /** */
+ protected static IgniteClient thinCli;
+
+ /** */
+ protected static ClientConfiguration thinCliCfg;
+
+ /** */
+ private final TransactionIsolation txIsolation = READ_COMMITTED;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.getTransactionConfiguration().setTxAwareQueriesEnabled(true);
+
+ return cfg;
+ }
+
+ /** */
+ private void startAllGrids() throws Exception {
+ srv = startGrids(gridCnt);
+ cli = startClientGrid("client");
+ }
+
+ /** */
+ private void startThinClient() {
+ thinCliCfg = new ClientConfiguration()
+ .setAddresses(Config.SERVER)
+ .setPartitionAwarenessEnabled(partitionAwareness);
+ thinCli = Ignition.startClient(thinCliCfg);
+ }
+
+ /** {@inheritDoc} */
+ @AfterAll
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ if (gridCnt != Ignition.allGrids().size() - 1) {
+ stopAllGrids();
+
+ startAllGrids();
+
+ startThinClient();
+
+ createCaches();
+ }
+
+ if (partitionAwareness != thinCliCfg.isPartitionAwarenessEnabled())
+ startThinClient();
+
+ boolean recreate = cli.cacheNames().stream()
+ .map(name -> cli.cache(name).getConfiguration(CacheConfiguration.class))
+ .filter(ccfg -> ccfg.getCacheMode() == CacheMode.PARTITIONED)
+ .anyMatch(ccfg -> backups != ccfg.getBackups());
+
+ if (recreate) {
+ cli.cacheNames().forEach(cli::destroyCache);
+
+ createCaches();
+ }
+
+ cli.cacheNames().forEach(name -> cli.cache(name).removeAll());
+
+ insert(F.t(1, JOHN));
+
+ assertEquals(gridCnt + 1, Ignition.allGrids().size());
+ assertEquals(partitionAwareness, thinCliCfg.isPartitionAwarenessEnabled());
+ cli.cacheNames().stream()
+ .map(name -> cli.cache(name).getConfiguration(CacheConfiguration.class))
+ .filter(ccfg -> ccfg.getCacheMode() == CacheMode.PARTITIONED)
+ .forEach(ccfg -> assertEquals(ccfg.getName(), backups, ccfg.getBackups()));
+ }
+
+ /** {@inheritDoc} */
+ @AfterEach
+ @Override protected void afterTest() throws Exception {
+ for (int i = 0; i < gridCnt + 1; i++) {
+ IgniteEx srv = i == gridCnt ? cli : grid(i);
+
+ assertTrue(srv.context().cache().context().tm().activeTransactions().isEmpty());
+
+ GridNioServer<ClientMessage> nioSrv = GridTestUtils.getFieldValue(srv.context().clientListener(), "srv");
+
+ for (GridNioSession ses : nioSrv.sessions()) {
+ Object meta = ses.meta(CONN_CTX_META_KEY);
+
+ if (meta instanceof ClientConnectionContext)
+ assertTrue(GridTestUtils.<Map<?, ?>>getFieldValue(meta, "txs").isEmpty());
+ else if (meta instanceof JdbcConnectionContext)
+ assertNull(GridTestUtils.getFieldValue(meta, "txCtx"));
+ else if (meta != null)
+ throw new IllegalStateException("Unknown context");
+ }
+ }
+ }
+
+ /** */
+ @Test
+ public void testInsert() {
+ ensureModeSupported();
+
+ Runnable checkBefore = () -> {
+ for (int i = 4; i <= (multi ? 6 : 4); i++) {
+ if (type != ExecutorType.THIN_JDBC)
+ assertNull(CACHE.name(), select(i, CACHE));
+ assertNull(QUERY.name(), select(i, QUERY));
+ }
+ };
+
+ Runnable checkAfter = () -> {
+ for (int i = 4; i <= (multi ? 6 : 4); i++) {
+ if (type != ExecutorType.THIN_JDBC)
+ assertEquals(CACHE.name(), JOHN, select(i, CACHE));
+ assertEquals(QUERY.name(), JOHN, select(i, QUERY));
+ }
+ };
+
+ checkBefore.run();
+
+ insideTx(() -> {
+ checkBefore.run();
+
+ if (multi)
+ insert(F.t(4, JOHN), F.t(5, JOHN), F.t(6, JOHN));
+ else
+ insert(F.t(4, JOHN));
+
+ if (modify == QUERY) {
+ GridTestUtils.assertThrows(
+ log,
+ () -> doInsert(false, F.t(4, JOHN)),
+ IgniteException.class,
+ "Failed to INSERT some keys because they are already in cache"
+ );
+ }
+
+ checkAfter.run();
+ }, commit);
+
+ if (commit)
+ checkAfter.run();
+ else
+ checkBefore.run();
+ }
+
+ /** */
+ @Test
+ public void testUpdate() {
+ ensureModeSupported();
+
+ if (multi)
+ insert(F.t(2, JOHN), F.t(3, JOHN));
+
+ Runnable checkBefore = () -> {
+ for (int i = 1; i <= (multi ? 3 : 1); i++) {
+ if (type != ExecutorType.THIN_JDBC)
+ assertEquals(JOHN, select(i, CACHE));
+ assertEquals(JOHN, select(i, QUERY));
+ }
+ };
+
+ Runnable checkAfter = () -> {
+ for (int i = 1; i <= (multi ? 3 : 1); i++) {
+ if (type != ExecutorType.THIN_JDBC)
+ assertEquals(KYLE, select(i, CACHE));
+ assertEquals(KYLE, select(i, QUERY));
+ }
+ };
+
+ checkBefore.run();
+
+ insideTx(() -> {
+ checkBefore.run();
+
+ if (multi)
+ update(F.t(1, SARAH), F.t(2, SARAH), F.t(3, SARAH));
+ else
+ update(F.t(1, SARAH));
+
+ for (int i = 1; i <= (multi ? 3 : 1); i++) {
+ if (type != ExecutorType.THIN_JDBC)
+ assertEquals(SARAH, select(i, CACHE));
+ assertEquals(SARAH, select(i, QUERY));
+ }
+
+ if (multi)
+ update(F.t(1, KYLE), F.t(2, KYLE), F.t(3, KYLE));
+ else
+ update(F.t(1, KYLE));
+
+ checkAfter.run();
+ }, commit);
+
+ if (commit)
+ checkAfter.run();
+ else
+ checkBefore.run();
+ }
+
+ /** */
+ @Test
+ public void testDelete() {
+ ensureModeSupported();
+
+ if (multi)
+ insert(F.t(2, JOHN), F.t(3, JOHN));
+
+ Runnable checkBefore = () -> {
+ for (int i = 1; i <= (multi ? 3 : 1); i++) {
+ if (type != ExecutorType.THIN_JDBC)
+ assertEquals(JOHN, select(i, CACHE));
+ assertEquals(JOHN, select(i, QUERY));
+ }
+ };
+
+ Runnable checkAfter = () -> {
+ for (int i = 1; i <= (multi ? 3 : 1); i++) {
+ if (type != ExecutorType.THIN_JDBC)
+ assertNull(select(i, CACHE));
+ assertNull(select(i, QUERY));
+ }
+ };
+
+ checkBefore.run();
+
+ insideTx(() -> {
+ checkBefore.run();
+
+ if (multi)
+ delete(1, 2, 3);
+ else
+ delete(1);
+
+ checkAfter.run();
+ }, commit);
+
+ if (commit)
+ checkAfter.run();
+ else
+ checkBefore.run();
+ }
+
+ /** */
+ protected void createCaches() {
+ cli.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+ .setCacheMode(mode)
+ .setBackups(backups));
+
+ for (CacheMode mode : CacheMode.values()) {
+ String users = tableName(USERS, mode);
+
+ LinkedHashMap<String, String> userFlds = new LinkedHashMap<>();
+
+ userFlds.put("id", Integer.class.getName());
+ userFlds.put("userId", Integer.class.getName());
+ userFlds.put("departmentId", Integer.class.getName());
+ userFlds.put("fio", String.class.getName());
+
+ cli.createCache(new CacheConfiguration<>()
+ .setName(users)
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+ .setCacheMode(mode)
+ .setBackups(backups)
+ .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
+ .setSqlSchema(QueryUtils.DFLT_SCHEMA)
+ .setQueryEntities(Collections.singleton(new QueryEntity()
+ .setTableName(users)
+ .setKeyType(Integer.class.getName())
+ .setValueType(User.class.getName())
+ .setKeyFieldName("id")
+ .setFields(userFlds)
+ .setIndexes(Arrays.asList(
+ new QueryIndex()
+ .setName("IDX_FIO_" + users)
+ .setFieldNames(Collections.singleton("fio"), true).setInlineSize(Character.BYTES * 20),
+ new QueryIndex()
+ .setName("IDX_USERID_" + users)
+ .setFieldNames(Collections.singleton("userId"), true)
+ )))));
+ }
+ }
+
+ /** */
+ protected void insideTx(RunnableX test, boolean commit) {
+ if (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY) {
+ try (ClientTransaction tx = thinCli.transactions().txStart(txConcurrency, txIsolation, TX_TIMEOUT)) {
+ for (int i = 0; i < 3; i++)
+ thinCli.cache(DEFAULT_CACHE_NAME).put(i, i);
+
+ test.run();
+
+ if (commit) {
+ for (int i = 0; i < 3; i++)
+ thinCli.cache(DEFAULT_CACHE_NAME).remove(i, i);
+
+ tx.commit();
+ }
+ else
+ tx.rollback();
+ }
+ }
+ else if (type == ExecutorType.SERVER || type == ExecutorType.CLIENT) {
+ Ignite initiator = node();
+
+ assertNotNull(initiator);
+
+ try (Transaction tx = initiator.transactions().txStart(txConcurrency, txIsolation, TX_TIMEOUT, TX_SIZE)) {
+ for (int i = 0; i < 3; i++)
+ initiator.cache(DEFAULT_CACHE_NAME).put(i, i);
+
+ test.run();
+
+ if (commit) {
+ for (int i = 0; i < 3; i++)
+ initiator.cache(DEFAULT_CACHE_NAME).remove(i, i);
+
+ tx.commit();
+ }
+ else
+ tx.rollback();
+ }
+ }
+ else
+ fail("Unknown executor type: " + type);
+ }
+
+ /** */
+ protected User select(Integer id, ModifyApi api) {
+ if (api == CACHE)
+ return (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY)
+ ? (User)thinCli.cache(users()).get(id)
+ : (User)node().cache(users()).get(id);
+
+ fail("Unknown select: " + api);
+
+ return null;
+ }
+
+ /** */
+ protected void insert(IgniteBiTuple<Integer, User>... entries) {
+ doInsert(false, entries);
+ }
+
+ /** */
+ protected void doInsert(boolean update, IgniteBiTuple<Integer, User>... entries) {
+ if (modify == CACHE) {
+ if (multi) {
+ Map<Integer, User> data = Arrays.stream(entries).collect(Collectors.toMap(IgniteBiTuple::get1, IgniteBiTuple::get2));
+
+ if (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY)
+ thinCli.cache(users()).putAll(data);
+ else
+ node().cache(users()).putAll(data);
+ }
+ else {
+ for (IgniteBiTuple<Integer, User> data : entries) {
+ if (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY)
+ thinCli.cache(users()).put(data.get1(), data.get2());
+ else
+ node().cache(users()).put(data.get1(), data.get2());
+ }
+ }
+ }
+ else if (modify == ENTRY_PROCESSOR) {
+ if (multi) {
+ Set<Integer> keys = Arrays.stream(entries).map(IgniteBiTuple::get1).collect(Collectors.toSet());
+ Map<Integer, User> data = Arrays.stream(entries).collect(Collectors.toMap(IgniteBiTuple::get1, IgniteBiTuple::get2));
+
+ if (type == ExecutorType.THIN_VIA_QUERY || type == ExecutorType.THIN_VIA_CACHE_API)
+ thinCli.cache(users()).invokeAll(keys, new UpdateEntryProcessor<>(update), data);
+ else
+ node().cache(users()).invokeAll(keys, new UpdateEntryProcessor<>(update), data);
+ }
+ else {
+ for (IgniteBiTuple<Integer, User> data : entries) {
+ if (type == ExecutorType.THIN_VIA_QUERY || type == ExecutorType.THIN_VIA_CACHE_API)
+ thinCli.cache(users()).invoke(data.get1(), new UpdateEntryProcessor<>(update), data.get2());
+ else
+ node().cache(users()).invoke(data.get1(), new UpdateEntryProcessor<>(update), data.get2());
+ }
+ }
+ }
+ else
+ fail("Unknown insert: " + modify);
+ }
+
+ /** */
+ protected void update(IgniteBiTuple<Integer, User>...entries) {
+ if (modify == CACHE || modify == ENTRY_PROCESSOR)
+ doInsert(true, entries);
+ else
+ fail("Unknown update: " + modify);
+ }
+
+ /** */
+ protected void delete(int... keys) {
+ if (modify == CACHE) {
+ if (multi) {
+ Set<Integer> toRemove = Arrays.stream(keys).boxed().collect(Collectors.toSet());
+
+ if (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY)
+ thinCli.cache(users()).removeAll(toRemove);
+ else
+ node().cache(users()).removeAll(toRemove);
+ }
+ else {
+ for (int id : keys) {
+ if (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY)
+ thinCli.cache(users()).remove(id);
+ else
+ node().cache(users()).remove(id);
+ }
+ }
+ }
+ else if (modify == ENTRY_PROCESSOR) {
+ if (multi) {
+ Set<Integer> toRemove = Arrays.stream(keys).boxed().collect(Collectors.toSet());
+
+ if (type == ExecutorType.THIN_VIA_QUERY || type == ExecutorType.THIN_VIA_CACHE_API)
+ thinCli.cache(users()).invokeAll(toRemove, new RemoveEntryProcessor<>());
+ else
+ node().cache(users()).invokeAll(toRemove, new RemoveEntryProcessor<>());
+ }
+ else {
+ for (int id : keys) {
+ if (type == ExecutorType.THIN_VIA_QUERY || type == ExecutorType.THIN_VIA_CACHE_API)
+ thinCli.cache(users()).invoke(id, new RemoveEntryProcessor<>());
+ else
+ node().cache(users()).invoke(id, new RemoveEntryProcessor<>());
+ }
+ }
+ }
+ else
+ fail("Unknown delete: " + modify);
+ }
+
+ /** */
+ protected IgniteEx node() {
+ assertTrue(type == ExecutorType.CLIENT || type == ExecutorType.SERVER);
+
+ return type == ExecutorType.CLIENT ? cli : srv;
+ }
+
+ /** */
+ protected String users() {
+ return tableName(USERS, mode);
+ }
+
+ /** */
+ protected static String tableName(String tbl, CacheMode mode) {
+ return tbl + "_" + mode;
+ }
+
+ /** */
+ protected void ensureModeSupported() {
+ // No-op.
+ }
+
+ /** */
+ public enum ExecutorType {
+ /** */
+ SERVER,
+
+ /** */
+ CLIENT,
+
+ /** */
+ THIN_VIA_CACHE_API,
+
+ /** */
+ THIN_VIA_QUERY,
+
+ /** */
+ THIN_JDBC
+ }
+
+ /** */
+ public enum ModifyApi {
+ /** */
+ CACHE,
+
+ /** */
+ ENTRY_PROCESSOR,
+
+ /** */
+ QUERY
+ }
+
+ /** */
+ public static class User {
+ /** */
+ @GridToStringInclude
+ public final int userId;
+
+ /** */
+ @GridToStringInclude
+ public final int departmentId;
+
+ /** */
+ @GridToStringInclude
+ public final String fio;
+
+ /** */
+ public User(int userId, int departmentId, String fio) {
+ this.userId = userId;
+ this.departmentId = departmentId;
+ this.fio = fio;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ User user = (User)o;
+ return userId == user.userId && departmentId == user.departmentId && Objects.equals(fio, user.fio);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return Objects.hash(userId, departmentId, fio);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(User.class, this);
+ }
+ }
+
+ /** */
+ public static class RemoveEntryProcessor<K, V, T> implements EntryProcessor<K, V, T> {
+ /** {@inheritDoc} */
+ @Override public T process(MutableEntry<K, V> entry, Object... arguments) throws EntryProcessorException {
+ entry.remove();
+
+ return null;
+ }
+ }
+
+ /** */
+ public static class UpdateEntryProcessor<K, V, T> implements EntryProcessor<K, V, T> {
+ /** */
+ private final boolean update;
+
+ /** */
+ public UpdateEntryProcessor() {
+ this(true);
+ }
+
+ /** */
+ public UpdateEntryProcessor(boolean update) {
+ this.update = update;
+ }
+
+ /** {@inheritDoc} */
+ @Override public T process(MutableEntry<K, V> entry, Object... arguments) throws EntryProcessorException {
+ assertEquals("Expect entry " + (update ? "" : "not") + " exists", update, entry.exists());
+
+ if (arguments[0] instanceof User)
+ entry.setValue((V)arguments[0]);
+ else
+ entry.setValue((V)((Map<Integer, User>)arguments[0]).get((Integer)entry.getKey()));
+
+ return null;
+ }
+ }
+}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsIsolationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsIsolationTest.java
index fa6fe9603c5..ea0d790e565 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsIsolationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsIsolationTest.java
@@ -52,24 +52,30 @@ import org.apache.ignite.client.ClientCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.cache.query.AbstractQueryTransactionIsolationTest;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.util.lang.RunnableX;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.transactions.TransactionConcurrency;
-import org.junit.Test;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static java.lang.String.format;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl.PROP_PREFIX;
-import static org.apache.ignite.internal.processors.cache.query.AbstractQueryTransactionIsolationTest.ModifyApi.CACHE;
-import static org.apache.ignite.internal.processors.cache.query.AbstractQueryTransactionIsolationTest.ModifyApi.QUERY;
+import static org.apache.ignite.internal.processors.tx.AbstractQueryTransactionIsolationTest.ModifyApi.CACHE;
+import static org.apache.ignite.internal.processors.tx.AbstractQueryTransactionIsolationTest.ModifyApi.QUERY;
import static org.apache.ignite.testframework.GridTestUtils.runAsync;
-import static org.junit.Assume.assumeFalse;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
/** */
+@ParameterizedClass(name = "gridCnt={0}, backups={1}, partitionAwareness={2}, mode={3}, execType={4}, " +
+ "modify={5}, commit={6}, multi={7}, txConcurrency={8}")
+@MethodSource("parameters")
public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolationTest {
/** */
public static final String DEPARTMENTS = "DEPARTMENTS";
@@ -78,32 +84,14 @@ public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolat
public static final String TBL = "TBL";
/** */
- private ThreadLocal<Connection> jdbcThinConn = ThreadLocal.withInitial(() -> {
- try {
- String addrs = partitionAwareness
- ? Ignition.allGrids().stream()
- .filter(n -> !n.configuration().isClientMode())
- .map(n -> "127.0.0.1:" + ((IgniteEx)n).context().clientListener().port())
- .collect(Collectors.joining(","))
- : "127.0.0.1:10800";
-
- return DriverManager.getConnection("jdbc:ignite:thin://" + addrs + "?"
- + PROP_PREFIX + "partitionAwareness=" + partitionAwareness + "&"
- + PROP_PREFIX + "transactionConcurrency=" + txConcurrency);
- }
- catch (SQLException e) {
- throw new RuntimeException(e);
- }
- });
+ private ThreadLocal<Connection> jdbcThinConn;
/** */
private final Map<Integer, Set<Integer>> partsToKeys = new HashMap<>();
/** @return Test parameters. */
- @Parameterized.Parameters(
- name = "gridCnt={0},backups={1},partitionAwareness={2},mode={3},execType={4},modify={5},commit={6},multi={7},txConcurrency={8}")
- public static Collection<?> parameters() {
- List<Object[]> params = new ArrayList<>();
+ private static Collection<Arguments> parameters() {
+ Collection<Arguments> params = new ArrayList<>();
for (int gridCnt : new int[]{1, 3}) {
int[] backups = gridCnt > 1
@@ -133,7 +121,7 @@ public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolat
}
for (ExecutorType execType : nodeExecTypes) {
- params.add(new Object[]{
+ params.add(Arguments.of(
gridCnt,
backup,
false, //partitionAwareness
@@ -143,12 +131,12 @@ public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolat
commit,
mutli,
txConcurrency
- });
+ ));
}
for (ExecutorType execType : thinExecTypes) {
for (boolean partitionAwareness : new boolean[]{false, true}) {
- params.add(new Object[]{
+ params.add(Arguments.of(
gridCnt,
backup,
partitionAwareness,
@@ -158,7 +146,7 @@ public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolat
commit,
mutli,
txConcurrency
- });
+ ));
}
}
}
@@ -222,12 +210,39 @@ public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolat
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
+ partsToKeys.clear();
+
+ jdbcThinConn = ThreadLocal.withInitial(() -> {
+ try {
+ String addrs = partitionAwareness
+ ? Ignition.allGrids().stream()
+ .filter(n -> !n.configuration().isClientMode())
+ .map(n -> "127.0.0.1:" + ((IgniteEx)n).context().clientListener().port())
+ .collect(Collectors.joining(","))
+ : "127.0.0.1:10800";
+
+ return DriverManager.getConnection("jdbc:ignite:thin://" + addrs + "?"
+ + PROP_PREFIX + "partitionAwareness=" + partitionAwareness + "&"
+ + PROP_PREFIX + "transactionConcurrency=" + txConcurrency);
+ }
+ catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ });
+
super.beforeTest();
assertEquals(mode, cli.cache(tbl()).getConfiguration(CacheConfiguration.class).getCacheMode());
}
+ /** {@inheritDoc} */
+ @BeforeAll
+ @Override protected void beforeTestsStarted() throws Exception {
+ // No-op.
+ }
+
/** */
@Test
public void testIndexScan() {
@@ -763,9 +778,7 @@ public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolat
else if (type == ExecutorType.THIN_JDBC) {
assertTrue("Partition filter not supported", F.isEmpty(parts));
- try {
- PreparedStatement stmt = jdbcThinConn.get().prepareStatement(sqlText);
-
+ try (PreparedStatement stmt = jdbcThinConn.get().prepareStatement(sqlText)) {
if (!F.isEmpty(args)) {
for (int i = 0; i < args.length; i++)
stmt.setObject(i + 1, args[i]);
@@ -823,8 +836,8 @@ public class SqlTransactionsIsolationTest extends AbstractQueryTransactionIsolat
/** {@inheritDoc} */
@Override protected void ensureModeSupported() {
assumeFalse(
- "Thin client doesn't support multiple statements for SQL",
- multi && modify == QUERY && (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY)
+ multi && modify == QUERY && (type == ExecutorType.THIN_VIA_CACHE_API || type == ExecutorType.THIN_VIA_QUERY),
+ "Thin client doesn't support multiple statements for SQL"
);
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsSavepointTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsSavepointTest.java
index 195d538c3e9..9a7f96628f1 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsSavepointTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsSavepointTest.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.processors.tx;
-import java.util.Arrays;
import java.util.List;
+import java.util.stream.Stream;
import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
@@ -32,12 +32,13 @@ import org.apache.ignite.internal.processors.query.calcite.integration.AbstractB
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
-
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.SAVEPOINTS_EXPLICIT_TX_ONLY;
import static org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTransactionalTest.SqlTransactionMode.ALL;
@@ -46,7 +47,8 @@ import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
/** Tests SQL savepoint commands executed by Calcite. */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "{0}")
+@MethodSource("parameters")
public class SqlTransactionsSavepointTest extends AbstractBasicIntegrationTest {
/** */
private static final String TBL = "SAVEPOINT_TEST_TABLE";
@@ -56,12 +58,11 @@ public class SqlTransactionsSavepointTest extends AbstractBasicIntegrationTest {
public TransactionConcurrency txConcurrency;
/** */
- @Parameters(name = "{0}")
- public static Iterable<Object[]> testData() {
- return Arrays.asList(new Object[][] {
- {PESSIMISTIC},
- {OPTIMISTIC}
- });
+ private static Stream<Arguments> parameters() {
+ return Stream.of(
+ Arguments.arguments(PESSIMISTIC),
+ Arguments.arguments(OPTIMISTIC)
+ );
}
/** {@inheritDoc} */
@@ -74,6 +75,7 @@ public class SqlTransactionsSavepointTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @AfterAll
@Override protected void afterTestsStopped() throws Exception {
stopAllGrids();
@@ -81,6 +83,7 @@ public class SqlTransactionsSavepointTest extends AbstractBasicIntegrationTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsUnsupportedModesTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsUnsupportedModesTest.java
index 970afaf456e..8df071ccd34 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsUnsupportedModesTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/SqlTransactionsUnsupportedModesTest.java
@@ -26,17 +26,16 @@ import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
-import org.junit.Test;
-
+import org.junit.jupiter.api.Test;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
/** */
-public class SqlTransactionsUnsupportedModesTest extends GridCommonAbstractTest {
+public class SqlTransactionsUnsupportedModesTest extends GridCommonAbstractWrapperTest {
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxThreadLockingTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxThreadLockingTest.java
index 6c451ac68db..7ff07c7c46d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxThreadLockingTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxThreadLockingTest.java
@@ -33,16 +33,21 @@ import org.apache.ignite.internal.processors.query.calcite.integration.AbstractB
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.transactions.Transaction;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
/** */
-@RunWith(Parameterized.class)
+@ParameterizedClass(name = "qryBlockingExecutor={0}")
+@MethodSource("parameters")
public class TxThreadLockingTest extends AbstractBasicIntegrationTest {
/** */
private static final long TIMEOUT = 10_000L;
@@ -57,21 +62,22 @@ public class TxThreadLockingTest extends AbstractBasicIntegrationTest {
private static final int MODIFY_BATCH_SIZE = AbstractExecutionTest.MODIFY_BATCH_SIZE;
/** Use query blocking executor. */
- @Parameterized.Parameter(0)
+ @Parameter(0)
public boolean qryBlockingExecutor;
/** */
- @Parameterized.Parameters(name = "qryBlockingExecutor={0}")
- public static Collection<?> parameters() {
- return List.of(false, true);
+ private static Collection<Arguments> parameters() {
+ return List.of(Arguments.of(false), Arguments.of(true));
}
/** {@inheritDoc} */
+ @BeforeAll
@Override protected void beforeTestsStarted() throws Exception {
// No-op.
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
System.setProperty(IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR, String.valueOf(qryBlockingExecutor));
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java
index c26425ec906..724a789a23c 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java
@@ -43,33 +43,36 @@ import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
import org.apache.ignite.internal.processors.cache.CacheLazyEntry;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.MapCacheStoreStrategy;
+import org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
/** Check per node data consistency after exceptionally interceptor method call. */
-@RunWith(Parameterized.class)
-public class TxWithExceptionalInterceptorTest extends GridCommonAbstractTest {
+@ParameterizedClass(name = "txCoordRole={0}, persistence={1}, writeThrough={2}")
+@MethodSource("parameters")
+public class TxWithExceptionalInterceptorTest extends GridCommonAbstractWrapperTest {
/** Node role. */
- @Parameterized.Parameter(0)
+ @Parameter(0)
public TxCoordNodeRole txCoord;
/** Persistence flag. */
- @Parameterized.Parameter(1)
+ @Parameter(1)
public boolean persistence;
/** Write through flag. */
- @Parameterized.Parameter(2)
+ @Parameter(2)
public boolean writeThrough;
/** */
@@ -94,8 +97,7 @@ public class TxWithExceptionalInterceptorTest extends GridCommonAbstractTest {
private static final MapCacheStoreStrategy strategy = new MapCacheStoreStrategy();
/** */
- @Parameterized.Parameters(name = "txCoordRole={0}, persistence={1}, writeThrough={2}")
- public static Collection<?> parameters() {
+ private static Collection<?> parameters() {
return GridTestUtils.cartesianProduct(
List.of(TxCoordNodeRole.PRIMARY, TxCoordNodeRole.BACKUP, TxCoordNodeRole.COORDINATOR_NO_DATA, TxCoordNodeRole.THICK_CLIENT),
List.of(true, false),
@@ -104,6 +106,7 @@ public class TxWithExceptionalInterceptorTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @BeforeEach
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -116,6 +119,7 @@ public class TxWithExceptionalInterceptorTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @AfterEach
@Override protected void afterTest() throws Exception {
super.afterTest();
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/SystemPropertiesExtension.java b/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/SystemPropertiesExtension.java
new file mode 100644
index 00000000000..1f8b3ded510
--- /dev/null
+++ b/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/SystemPropertiesExtension.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.testframework.junit;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.jetbrains.annotations.Nullable;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/**
+ * JUnit rule that manages usage of {@link WithSystemProperty} annotations.<br> Should be used in {@link ExtendWith}.
+ *
+ * @see WithSystemProperty
+ * @see ExtendWith
+ */
+public class SystemPropertiesExtension implements
+ BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+ /** JUnit namespace for the extension. */
+ private static final ExtensionContext.Namespace NAMESPACE = ExtensionContext.Namespace.create(SystemPropertiesExtension.class);
+
+ /** {@inheritDoc} */
+ @Override public void beforeAll(ExtensionContext ctx) {
+ List<WithSystemProperty> newProps = new ArrayList<>();
+
+ for (Class<?> cls = ctx.getRequiredTestClass(); cls != null; cls = cls.getSuperclass()) {
+ WithSystemProperty[] props = cls.getAnnotationsByType(WithSystemProperty.class);
+
+ if (props.length > 0) {
+ newProps.addAll(Arrays.asList(props));
+ }
+ }
+
+ if (newProps.isEmpty()) {
+ return;
+ }
+
+ // Reverse the collected properties to set properties from the superclass first. This may be important
+ // if the same property gets overridden in a subclass.
+ Collections.reverse(newProps);
+
+ List<Property> oldProps = replaceProperties(newProps);
+
+ ctx.getStore(NAMESPACE).put(ctx.getUniqueId(), oldProps);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void afterAll(ExtensionContext ctx) {
+ resetProperties(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void beforeEach(ExtensionContext ctx) {
+ WithSystemProperty[] newProps = ctx.getRequiredTestMethod().getAnnotationsByType(WithSystemProperty.class);
+
+ if (newProps.length == 0) {
+ return;
+ }
+
+ List<Property> oldProps = replaceProperties(Arrays.asList(newProps));
+
+ ctx.getStore(NAMESPACE).put(ctx.getUniqueId(), oldProps);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void afterEach(ExtensionContext ctx) {
+ resetProperties(ctx);
+ }
+
+ /**
+ * Replaces the system properties with the given properties.
+ *
+ * @return List of the previous property values.
+ */
+ private static List<Property> replaceProperties(List<WithSystemProperty> newProps) {
+ // List of system properties to set when test is finished.
+ var oldProps = new ArrayList<Property>(newProps.size());
+
+ for (WithSystemProperty prop : newProps) {
+ String oldVal = System.setProperty(prop.key(), prop.value());
+
+ oldProps.add(new Property(prop.key(), oldVal));
+ }
+
+ return oldProps;
+ }
+
+ /**
+ * Resets the system properties to the pre-test state.
+ */
+ private static void resetProperties(ExtensionContext ctx) {
+ List<Property> oldProps = ctx.getStore(NAMESPACE).remove(ctx.getUniqueId(), List.class);
+
+ if (oldProps == null) {
+ return; // Nothing to do.
+ }
+
+ // Bring back the old properties in the reverse order
+ Collections.reverse(oldProps);
+
+ for (Property prop : oldProps) {
+ if (prop.val == null)
+ System.clearProperty(prop.key);
+ else
+ System.setProperty(prop.key, prop.val);
+ }
+ }
+
+ /** Property. */
+ private static class Property {
+ /** Property key. */
+ final String key;
+
+ /** Property value. */
+ @Nullable
+ final String val;
+
+ /**
+ * Constructor.
+ *
+ * @param key Property key.
+ * @param val Property value.
+ */
+ Property(String key, @Nullable String val) {
+ this.key = key;
+ this.val = val;
+ }
+ }
+}
+
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite3.java b/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/SystemPropertiesList.java
similarity index 57%
copy from modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite3.java
copy to modules/calcite/src/test/java/org/apache/ignite/testframework/junit/SystemPropertiesList.java
index 4d9074ecfc8..170f5d7d4e5 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite3.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/SystemPropertiesList.java
@@ -15,17 +15,21 @@
* limitations under the License.
*/
-package org.apache.ignite.testsuites;
+package org.apache.ignite.testframework.junit;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
- * Calcite tests.
+ * {@link Repeatable} for the {@link WithSystemProperty}.<br/> Not intended for direct usage. Use multiple {@link WithSystemProperty}
+ * annotation instead.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- IntegrationTestSuite.class
-})
-public class IgniteCalciteTestSuite3 {
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface SystemPropertiesList {
+ /** Array of underlying annotations. */
+ WithSystemProperty[] value();
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/WithSystemProperty.java b/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/WithSystemProperty.java
new file mode 100644
index 00000000000..0c117acb4a3
--- /dev/null
+++ b/modules/calcite/src/test/java/org/apache/ignite/testframework/junit/WithSystemProperty.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.testframework.junit;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+
+/**
+ * Annotation that defines a scope with specific system property configured.<br>
+ * <br>
+ * Might be used on class level or on method level. Multiple annotations might be applied to the same class/method.<br>
+ * <br>
+ * In short, these two approaches are basically equivalent:<br>
+ * <br>
+ * Short:
+ * <pre><code> {@literal @}WithSystemProperty(key = "name", value = "val")
+ * public class SomeTest {
+ * }</code></pre>
+ * Long:
+ * <pre><code> public class SomeTest {
+ * private static Object oldVal;
+ *
+ * {@literal @}BeforeClass
+ * public static void beforeClass() {
+ * oldVal = System.getProperty("name");
+ *
+ * System.setProperty("name", "val");
+ * }
+ *
+ * {@literal @}AfterClass
+ * public static void afterClass() {
+ * if (oldVal == null)
+ * System.clearProperty("name");
+ * else
+ * System.setProperty("name", oldVal);
+ * }
+ * }</code></pre>
+ *
+ * <p>Same applies to methods with the difference that annotation translates into something like {@link BeforeEach} and {@link AfterEach}.
+ * <br><br>
+ * <pre><code> public class SomeTest {
+ * {@literal @}Test
+ * {@literal @}WithSystemProperty(key = "name", value = "val")
+ * public void test() {
+ * // ...
+ * }
+ * }
+ * </code></pre>
+ * is equivalent to:
+ * <pre><code> public class SomeTest {
+ * {@literal @}Test
+ * public void test() {
+ * Object oldVal = System.getProperty("name");
+ *
+ * try {
+ * // ...
+ * }
+ * finally {
+ * if (oldVal == null)
+ * System.clearProperty("name");
+ * else
+ * System.setProperty("name", oldVal);
+ * }
+ * }
+ * }
+ * </code></pre>
+ * For class level annotation it applies system properties for the whole class hierarchy (ignoring interfaces, there's no linearization
+ * implemented). More specific classes have higher priority and set their properties last. It all starts with {@link Object} which, of
+ * course, is not annotated.<br>
+ * <br>
+ * Test methods do not inherit their annotations from overridden methods of super class.<br>
+ * <br>
+ * If more than one annotation is presented on class/method then they will be applied in the same order as they appear in code. It is
+ * achieved with the help of {@link Repeatable} feature of Java annotations - {@link SystemPropertiesList} is automatically generated in
+ * such cases. For that reason it is not recommended using {@link SystemPropertiesList} directly.
+ *
+ * @see System#setProperty(String, String)
+ * @see SystemPropertiesExtension
+ * @see SystemPropertiesList
+ */
+@Repeatable(SystemPropertiesList.class)
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface WithSystemProperty {
+ /** The name of the system property. */
+ String key();
+
+ /** The value of the system property. */
+ String value();
+}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/ExecutionTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/ExecutionTestSuite.java
index 6b019816849..2c62be0aff7 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/ExecutionTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/ExecutionTestSuite.java
@@ -37,14 +37,14 @@ import org.apache.ignite.internal.processors.query.calcite.exec.rel.TableSpoolEx
import org.apache.ignite.internal.processors.query.calcite.exec.rel.TimeCalculationExecutionTest;
import org.apache.ignite.internal.processors.query.calcite.exec.rel.UncollectExecutionTest;
import org.apache.ignite.internal.processors.query.calcite.exec.rel.WindowExecutionTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* Calcite execution tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
ExecutionTest.class,
ContinuousExecutionTest.class,
MergeJoinExecutionTest.class,
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite.java
index d1417c7d124..2de7fb99383 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite.java
@@ -27,14 +27,14 @@ import org.apache.ignite.internal.processors.query.calcite.sql.SqlSelectForUpdat
import org.apache.ignite.internal.processors.tx.SqlTransactionsIsolationTest;
import org.apache.ignite.internal.processors.tx.SqlTransactionsSavepointTest;
import org.apache.ignite.internal.processors.tx.SqlTransactionsUnsupportedModesTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* Calcite tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
UtilTestSuite.class,
ParserCodegenResourcesTest.class,
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite2.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite2.java
index 68002b45635..abbcf2f1857 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite2.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite2.java
@@ -17,14 +17,16 @@
package org.apache.ignite.testsuites;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.apache.ignite.internal.processors.query.calcite.integration.TestSuiteDeclarationArchTest;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* Calcite tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
+ TestSuiteDeclarationArchTest.class,
PlannerTestSuite.class,
ExecutionTestSuite.class,
JdbcTestSuite.class,
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite3.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite3.java
index 4d9074ecfc8..3832c3469f1 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite3.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IgniteCalciteTestSuite3.java
@@ -17,14 +17,15 @@
package org.apache.ignite.testsuites;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
+
/**
* Calcite tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
IntegrationTestSuite.class
})
public class IgniteCalciteTestSuite3 {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
index c9605a431cd..833729b5e0b 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
@@ -104,14 +104,14 @@ import org.apache.ignite.internal.processors.query.calcite.rules.ProjectScanMerg
import org.apache.ignite.internal.processors.query.calcite.thin.MultiLineQueryTest;
import org.apache.ignite.internal.processors.tx.TxThreadLockingTest;
import org.apache.ignite.internal.processors.tx.TxWithExceptionalInterceptorTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* Calcite tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
OrToUnionRuleTest.class,
ProjectScanMergeRuleTest.class,
CalciteQueryProcessorTest.class,
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/JdbcTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/JdbcTestSuite.java
index b69f3cf8347..2e2a21ff770 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/JdbcTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/JdbcTestSuite.java
@@ -25,14 +25,14 @@ import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcSetClientInf
import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcSetClientInfoTest;
import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcThinConnectionSavepointTest;
import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcThinTransactionalSelfTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* Calcite JDBC tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
JdbcQueryTest.class,
JdbcCrossEngineTest.class,
JdbcThinConnectionSavepointTest.class,
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java
index bac3237c636..66c7335d270 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java
@@ -55,14 +55,14 @@ import org.apache.ignite.internal.processors.query.calcite.planner.UserDefinedVi
import org.apache.ignite.internal.processors.query.calcite.planner.WindowPlannerTest;
import org.apache.ignite.internal.processors.query.calcite.planner.hints.HintsTestSuite;
import org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchQueryPlannerTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* Calcite tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
PlanExecutionTest.class,
PlanSplitterTest.class,
CorrelatedNestedLoopJoinPlannerTest.class,
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/ScriptTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/ScriptTestSuite.java
index fbed0087a3a..490eec90ed7 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/ScriptTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/ScriptTestSuite.java
@@ -17,9 +17,37 @@
package org.apache.ignite.testsuites;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.regex.Pattern;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.internal.processors.query.QueryEngine;
import org.apache.ignite.internal.processors.query.calcite.logical.ScriptRunnerTestsEnvironment;
-import org.apache.ignite.internal.processors.query.calcite.logical.ScriptTestRunner;
-import org.junit.runner.RunWith;
+import org.apache.ignite.internal.processors.query.calcite.logical.SqlScriptRunner;
+import org.apache.ignite.internal.processors.query.calcite.util.Commons;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
+import org.apache.ignite.thread.IgniteThread;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.DynamicTest;
+import org.junit.jupiter.api.TestFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* Test suite to run SQL test scripts.
@@ -71,7 +99,253 @@ import org.junit.runner.RunWith;
* @see <a href="https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki">Extended format documentation.</a></a>
*
*/
-@RunWith(ScriptTestRunner.class)
@ScriptRunnerTestsEnvironment(scriptsRoot = "modules/calcite/src/test/sql", timeout = 180000)
public class ScriptTestSuite {
+ /** Filesystem. */
+ private static final FileSystem FS = FileSystems.getDefault();
+
+ /** Suffix of the scripts that are reported as ignored. */
+ private static final String IGNORED_SUFFIX = ".test_ignore";
+
+ /** Shared finder. */
+ private static final TcpDiscoveryVmIpFinder sharedFinder = new TcpDiscoveryVmIpFinder().setShared(true);
+
+ /** */
+ private static IgniteLogger log;
+
+ static {
+ try {
+ log = new GridTestLog4jLogger(U.resolveIgnitePath("modules/core/src/test/config/log4j2-test.xml"));
+ }
+ catch (Exception e) {
+ e.printStackTrace(System.err);
+
+ log = null;
+
+ assert false : "Cannot init logger";
+ }
+ }
+
+ /** Scripts root directory. */
+ private final Path scriptsRoot;
+
+ /** Regex to filter test path to run only specified tests. */
+ private final Pattern testRegex;
+
+ /** Nodes count. */
+ private final int nodes;
+
+ /** Restart cluster for each test group. */
+ private final boolean restartCluster;
+
+ /** Test script timeout. */
+ private final long timeout;
+
+ /** Directory (test group) of the last executed script. */
+ private Path lastTestDir;
+
+ /** */
+ public ScriptTestSuite() {
+ ScriptRunnerTestsEnvironment env = ScriptTestSuite.class.getAnnotation(ScriptRunnerTestsEnvironment.class);
+
+ assertFalse(F.isEmpty(env.scriptsRoot()));
+
+ nodes = env.nodes();
+ scriptsRoot = FS.getPath(U.resolveIgnitePath(env.scriptsRoot()).getPath());
+ testRegex = F.isEmpty(env.regex()) ? null : Pattern.compile(env.regex());
+ restartCluster = env.restart();
+ timeout = env.timeout();
+ }
+
+ /**
+ * Generates dynamic tests for each script file in the configured directory.
+ *
+ * @return Stream of dynamic tests.
+ * @throws Exception If failed to walk the script directory.
+ */
+ @TestFactory
+ public List<DynamicTest> generateTests() throws Exception {
+ // Start cluster if not already started
+ if (F.isEmpty(Ignition.allGrids())) {
+ startCluster();
+ }
+
+ return Files.walk(scriptsRoot)
+ .sorted()
+ .filter(p -> !p.equals(scriptsRoot))
+ .filter(p -> !Files.isDirectory(p))
+ .filter(p -> testRegex == null || testRegex.matcher(p.toString()).find())
+ .filter(p -> {
+ String fileName = p.getFileName().toString();
+
+ return testRegex != null || fileName.endsWith(".test") || fileName.endsWith(".test_slow")
+ || fileName.endsWith(IGNORED_SUFFIX);
+ })
+ .map(p -> {
+ String dirName;
+ if (p.getNameCount() - 1 > scriptsRoot.getNameCount())
+ dirName = p.subpath(scriptsRoot.getNameCount(), p.getNameCount() - 1).toString();
+ else
+ dirName = scriptsRoot.subpath(scriptsRoot.getNameCount() - 1, scriptsRoot.getNameCount()).toString();
+
+ String fileName = p.getFileName().toString();
+
+ // Ignored scripts are reported as skipped (only when no regex filter is set).
+ if (testRegex == null && fileName.endsWith(IGNORED_SUFFIX)) {
+ return DynamicTest.dynamicTest(dirName + "/" + fileName,
+ () -> Assumptions.abort("Script is ignored: " + dirName + "/" + fileName));
+ }
+
+ return DynamicTest.dynamicTest(dirName + "/" + fileName, () -> {
+ runSingleTest(p, dirName, fileName);
+ });
+ })
+ .toList();
+ }
+
+ /** */
+ @AfterAll
+ public static void tearDown() {
+ IgnitionEx.stopAll(true, null);
+ }
+
+ /**
+ * Runs a single test.
+ *
+ * @param test Test file path.
+ * @param dirName Directory name.
+ * @param fileName File name.
+ * @throws Exception If test fails.
+ */
+ private void runSingleTest(Path test, String dirName, String fileName) {
+ beforeTest(test.getParent());
+
+ log.info(">>> Start: " + dirName + "/" + fileName);
+
+ try {
+ Ignite ign = F.first(Ignition.allGrids());
+
+ QueryEngine engine = Commons.lookupComponent(
+ ((IgniteEx)ign).context(),
+ QueryEngine.class
+ );
+
+ SqlScriptRunner scriptTestRunner = new SqlScriptRunner(test, engine, log);
+
+ try {
+ runScript(scriptTestRunner);
+ }
+ catch (Error | RuntimeException e) {
+ throw e;
+ }
+ catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
+ }
+ finally {
+ log.info(">>> Finish: " + dirName + "/" + fileName);
+ }
+ }
+
+ /**
+ * Cleanup before test.
+ *
+ * @param testDir Directory (test group) of the script to run.
+ */
+ private void beforeTest(Path testDir) {
+ // Restart cluster only on a test group (directory) boundary.
+ if (restartCluster && lastTestDir != null && !lastTestDir.equals(testDir) && !F.isEmpty(Ignition.allGrids())) {
+ log.info(">>> Restart cluster");
+
+ Ignition.stopAll(false);
+ }
+
+ lastTestDir = testDir;
+
+ if (F.isEmpty(Ignition.allGrids()))
+ startCluster();
+ else {
+ Ignite ign = F.first(Ignition.allGrids());
+
+ for (String cacheName : ign.cacheNames())
+ ign.destroyCache(cacheName);
+ }
+ }
+
+ /**
+ * Starts the cluster.
+ */
+ private void startCluster() {
+ for (int i = 0; i < nodes; ++i) {
+ Ignition.start(
+ new IgniteConfiguration()
+ .setIgniteInstanceName("srv" + i)
+ .setDiscoverySpi(
+ new TcpDiscoverySpi()
+ .setIpFinder(sharedFinder)
+ )
+ .setGridLogger(log)
+ );
+ }
+ }
+
+ /**
+ * Runs the script with timeout support.
+ *
+ * @param scriptRunner Script runner.
+ */
+ private void runScript(SqlScriptRunner scriptRunner) throws Throwable {
+ final AtomicReference<Throwable> ex = new AtomicReference<>();
+
+ Thread runner = new IgniteThread("srv0", "test-runner", new Runnable() {
+ @Override public void run() {
+ try {
+ scriptRunner.run();
+ }
+ catch (Throwable e) {
+ ex.set(e);
+ }
+ }
+ });
+
+ runner.start();
+
+ runner.join(timeout);
+
+ if (runner.isAlive()) {
+ U.error(log,
+ "Test has been timed out and will be interrupted");
+
+ List<Ignite> nodes = IgnitionEx.allGridsx();
+
+ for (Ignite node : nodes)
+ ((IgniteKernal)node).dumpDebugInfo();
+
+ // We dump threads to stdout, because we can loose logs in case
+ // the build is cancelled on TeamCity.
+ U.dumpThreads(null);
+
+ U.dumpThreads(log);
+
+ // Try to interrupt runner several times for case when InterruptedException is handled invalid.
+ for (int i = 0; i < 100 && runner.isAlive(); ++i) {
+ U.interrupt(runner);
+
+ U.sleep(10);
+ }
+
+ U.join(runner, log);
+
+ // Restart cluster
+ Ignition.stopAll(true);
+ startCluster();
+
+ throw new TimeoutException("Test has been timed out");
+ }
+
+ Throwable t = ex.get();
+
+ if (t != null)
+ throw t;
+ }
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/UtilTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/UtilTestSuite.java
index 2a731dde3d3..0fb1a748d76 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/UtilTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/UtilTestSuite.java
@@ -26,14 +26,14 @@ import org.apache.ignite.internal.processors.query.calcite.exec.task.QueryTasksQ
import org.apache.ignite.internal.processors.query.calcite.exec.tracker.MemoryTrackerTest;
import org.apache.ignite.internal.processors.query.calcite.type.OtherTypeTest;
import org.apache.ignite.internal.processors.query.calcite.util.TypeUtilsTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.platform.suite.api.SelectClasses;
+import org.junit.platform.suite.api.Suite;
/**
* Calcite utility classes tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
+@Suite
+@SelectClasses({
ClosableIteratorsHolderTest.class,
MemoryTrackerTest.class,
QueryCheckerTest.class,
diff --git a/modules/calcite/src/test/resources/junit-platform.properties b/modules/calcite/src/test/resources/junit-platform.properties
new file mode 100644
index 00000000000..84e51f46273
--- /dev/null
+++ b/modules/calcite/src/test/resources/junit-platform.properties
@@ -0,0 +1,14 @@
+# Catch-all fallback timeout for all test and lifecycle methods.
+junit.jupiter.execution.timeout.default = 5m
+
+# Specific default timeout for standard @Test methods (overrides the catch-all).
+junit.jupiter.execution.timeout.test.method.default = 5m
+
+# Specific default timeout for lifecycle methods (e.g., @BeforeEach, @AfterAll).
+junit.jupiter.execution.timeout.lifecycle.method.default = 60s
+
+# Dump threads if test runs more than expected.
+junit.jupiter.execution.timeout.threaddump.enabled = true
+
+# With random run GridTestClockTimer can never be initialized.
+junit.jupiter.testclass.order.default=org.junit.jupiter.api.ClassOrderer$OrderAnnotation
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index a18a89e52dd..563b246fb8d 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -683,6 +683,11 @@ public abstract class GridAbstractTest extends JUnitAssertAware {
sft.mkdirMarshaller();
}
+ /** */
+ protected static void beforeFirstTest0() {
+ sharedStaticIpFinder = new TcpDiscoveryVmIpFinder(true);
+ }
+
/** */
protected void beforeFirstTest() throws Exception {
sharedStaticIpFinder = new TcpDiscoveryVmIpFinder(true);
@@ -777,7 +782,7 @@ public abstract class GridAbstractTest extends JUnitAssertAware {
* @param afterTestFinished Boolean flag used to tell whether {@code afterTest()} finished execution.
* @return Scheduled executor used when scheduling.
*/
- private ScheduledExecutorService scheduleThreadDumpOnAfterTestTimeOut(AtomicBoolean afterTestFinished) {
+ public ScheduledExecutorService scheduleThreadDumpOnAfterTestTimeOut(AtomicBoolean afterTestFinished) {
// Compute class name as string to avoid holding reference to the test class instance in task.
String testClsName = getClass().getName();
diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/junit/JUnitTeamcityReporter.java b/modules/tools/src/main/java/org/apache/ignite/tools/junit/JUnitTeamcityReporter.java
index 463c41ab4c3..9ddcc276cf6 100644
--- a/modules/tools/src/main/java/org/apache/ignite/tools/junit/JUnitTeamcityReporter.java
+++ b/modules/tools/src/main/java/org/apache/ignite/tools/junit/JUnitTeamcityReporter.java
@@ -220,8 +220,12 @@ public class JUnitTeamcityReporter extends RunListener {
return "test-" + prevSuite + prevFlush + ".xml";
}
- /** */
- private String escapeForTeamcity(String msg) {
+ /**
+ * @param msg Message.
+ *
+ * @return Escaped string.
+ */
+ public static String escapeForTeamcity(String msg) {
return (msg == null ? "null" : msg)
.replace("|", "||")
.replace("\r", "|r")
diff --git a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java
index 6d6351b3bf6..9398ec287b8 100644
--- a/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java
+++ b/modules/tools/src/main/java/org/apache/ignite/tools/surefire/testsuites/CheckAllTestsInSuites.java
@@ -113,6 +113,13 @@ public class CheckAllTestsInSuites {
}
}
+ /** Calcite module tests inherited from legacy junit4 related classes. */
+ private static final Set<String> CALCITE_TESTS = Set.of(
+ "org.apache.ignite.internal.processors.query.calcite.IndexWithSameNameCalciteTest",
+ "org.apache.ignite.internal.processors.cache.DdlTransactionCalciteSelfTest",
+ "org.apache.ignite.internal.processors.query.calcite.message.CalciteCommunicationMessageSerializationTest"
+ );
+
/**
* Check whether class is a test class or a suite.
*
@@ -121,11 +128,13 @@ public class CheckAllTestsInSuites {
* Exclusion of the rule is Parameterized.class, so classes are marked with it are test classes.
*/
private boolean isTestClass(Description desc) {
+ if (CALCITE_TESTS.contains(desc.getDisplayName()))
+ return false;
+
RunWith runWith = desc.getAnnotation(RunWith.class);
return runWith == null
|| runWith.value().equals(Parameterized.class)
- || !(Suite.class.isAssignableFrom(runWith.value())
- || "org.scalatest.Suites".equals(desc.getTestClass().getSuperclass().getName()));
+ || !(Suite.class.isAssignableFrom(runWith.value()));
}
}
diff --git a/parent/pom.xml b/parent/pom.xml
index fe00f4b4295..be4f5e19704 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -967,12 +967,15 @@
<inputExclude>**/*.cmd</inputExclude>
<inputExclude>**/*.ps1</inputExclude>
<inputExclude>**/*.json</inputExclude>
+ <inputExclude>**/apache-2.0.txt</inputExclude>
<inputExclude>**/.dockerignore</inputExclude>
<inputExclude>modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExpectedOutput/*.txt</inputExclude>
<!--Packaging -->
<inputExclude>packaging/**</inputExclude>
<!-- Calcite test scripts -->
<inputExclude>src/test/sql/**</inputExclude>
+ <!-- Calcite stuff -->
+ <inputExclude>src/test/resources/junit-platform.properties</inputExclude>
<!-- Ignite Documentation-->
<inputExclude>docs/_site/**</inputExclude>
<inputExclude>docs/assets/images/**</inputExclude>