This is an automated email from the ASF dual-hosted git repository.

leonard pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new b9f3b957cc1 [FLINK-33637][table-planner][JUnit5 Migration] Introduce 
ArchTest to ban Junit4 for table-planner module
b9f3b957cc1 is described below

commit b9f3b957cc136a65c55b0b93d5e0bab2b412f8f3
Author: Jiabao Sun <[email protected]>
AuthorDate: Wed Nov 29 14:11:20 2023 +0800

    [FLINK-33637][table-planner][JUnit5 Migration] Introduce ArchTest to ban 
Junit4 for table-planner module
    
    This closes #23791.
---
 .../26d337fc-45c4-4d03-a84a-6692c37fafbc           |  6 ---
 .../337c411e-1885-4f85-8070-aabe3638eb43           |  6 ---
 .../62c5e4e5-2b0e-41ed-a268-ee33d5edd162           |  6 ---
 .../8a4ac4b1-94ba-4a1d-a639-b2bd22868374           |  6 ---
 .../1b8e145e-3f0a-4415-b463-37a87dd0a998           |  6 ---
 .../8905dbb5-c749-4c80-8848-c31e55f572f4           |  0
 .../95e87b01-d1fe-4240-9e71-b8105bccba6a           |  0
 .../a17c9d3e-9546-4787-a16e-91f74fc9a335           |  0
 .../archunit-violations/stored.rules               |  5 +++
 flink-table/flink-table-planner/pom.xml            |  8 ++++
 .../architecture/TestCodeArchitectureTest.java     | 49 ++++++++++++++++++++++
 .../flink/table/planner/catalog/CatalogITCase.java |  5 +++
 .../BuiltInAggregateFunctionTestBase.java          |  6 ++-
 .../planner/functions/BuiltInFunctionTestBase.java |  6 ++-
 .../runtime/batch/sql/MatchRecognizeITCase.java    |  5 +++
 .../runtime/utils/AtomicCtasITCaseBase.java        |  8 +++-
 .../runtime/utils/AtomicRtasITCaseBase.java        |  8 +++-
 .../runtime/utils/BatchAbstractTestBase.java       | 12 +++---
 .../runtime/utils/JoinReorderITCaseBase.java       | 14 ++++++-
 .../runtime/utils/StreamAbstractTestBase.java      | 38 +++++++++++++++++
 .../src/test/resources/archunit.properties         | 31 ++++++++++++++
 .../planner/runtime/utils/StreamingTestBase.scala  | 15 +------
 .../runtime/utils/StreamingWithStateTestBase.scala |  2 +-
 23 files changed, 181 insertions(+), 61 deletions(-)

diff --git 
a/flink-connectors/flink-connector-hive/archunit-violations/26d337fc-45c4-4d03-a84a-6692c37fafbc
 
b/flink-connectors/flink-connector-hive/archunit-violations/26d337fc-45c4-4d03-a84a-6692c37fafbc
index 23159a1c4d2..54a70069a6c 100644
--- 
a/flink-connectors/flink-connector-hive/archunit-violations/26d337fc-45c4-4d03-a84a-6692c37fafbc
+++ 
b/flink-connectors/flink-connector-hive/archunit-violations/26d337fc-45c4-4d03-a84a-6692c37fafbc
@@ -38,12 +38,6 @@ org.apache.flink.connectors.hive.HiveTableSinkITCase does 
not satisfy: only one
 * reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
 * reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
 * reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
- or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
-org.apache.flink.connectors.hive.HiveTableSourceITCase does not satisfy: only 
one of the following predicates match:\
-* reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
-* reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
 * reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
  or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
 org.apache.flink.connectors.hive.HiveTemporalJoinITCase does not satisfy: only 
one of the following predicates match:\
diff --git 
a/flink-formats/flink-avro/archunit-violations/337c411e-1885-4f85-8070-aabe3638eb43
 
b/flink-formats/flink-avro/archunit-violations/337c411e-1885-4f85-8070-aabe3638eb43
index dc362499e77..7a053226700 100644
--- 
a/flink-formats/flink-avro/archunit-violations/337c411e-1885-4f85-8070-aabe3638eb43
+++ 
b/flink-formats/flink-avro/archunit-violations/337c411e-1885-4f85-8070-aabe3638eb43
@@ -2,12 +2,6 @@ org.apache.flink.formats.avro.AvroExternalJarProgramITCase 
does not satisfy: onl
 * reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
 * reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
 * reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
- or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
-org.apache.flink.formats.avro.AvroFilesystemITCase does not satisfy: only one 
of the following predicates match:\
-* reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
-* reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
 * reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
  or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
 
org.apache.flink.formats.avro.typeutils.AvroSerializerConcurrencyCheckInactiveITCase
 does not satisfy: only one of the following predicates match:\
diff --git 
a/flink-formats/flink-json/archunit-violations/62c5e4e5-2b0e-41ed-a268-ee33d5edd162
 
b/flink-formats/flink-json/archunit-violations/62c5e4e5-2b0e-41ed-a268-ee33d5edd162
index b7880300cd7..e69de29bb2d 100644
--- 
a/flink-formats/flink-json/archunit-violations/62c5e4e5-2b0e-41ed-a268-ee33d5edd162
+++ 
b/flink-formats/flink-json/archunit-violations/62c5e4e5-2b0e-41ed-a268-ee33d5edd162
@@ -1,6 +0,0 @@
-org.apache.flink.formats.json.JsonBatchFileSystemITCase does not satisfy: only 
one of the following predicates match:\
-* reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
-* reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
- or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
\ No newline at end of file
diff --git 
a/flink-formats/flink-orc/archunit-violations/8a4ac4b1-94ba-4a1d-a639-b2bd22868374
 
b/flink-formats/flink-orc/archunit-violations/8a4ac4b1-94ba-4a1d-a639-b2bd22868374
index 3ad8bba2279..cbdfe324865 100644
--- 
a/flink-formats/flink-orc/archunit-violations/8a4ac4b1-94ba-4a1d-a639-b2bd22868374
+++ 
b/flink-formats/flink-orc/archunit-violations/8a4ac4b1-94ba-4a1d-a639-b2bd22868374
@@ -1,9 +1,3 @@
-org.apache.flink.orc.OrcFileSystemITCase does not satisfy: only one of the 
following predicates match:\
-* reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
-* reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
- or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
 org.apache.flink.orc.writer.OrcBulkWriterITCase does not satisfy: only one of 
the following predicates match:\
 * reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
 * reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
diff --git 
a/flink-formats/flink-parquet/archunit-violations/1b8e145e-3f0a-4415-b463-37a87dd0a998
 
b/flink-formats/flink-parquet/archunit-violations/1b8e145e-3f0a-4415-b463-37a87dd0a998
index c95cd417d66..e69de29bb2d 100644
--- 
a/flink-formats/flink-parquet/archunit-violations/1b8e145e-3f0a-4415-b463-37a87dd0a998
+++ 
b/flink-formats/flink-parquet/archunit-violations/1b8e145e-3f0a-4415-b463-37a87dd0a998
@@ -1,6 +0,0 @@
-org.apache.flink.formats.parquet.ParquetFileSystemITCase does not satisfy: 
only one of the following predicates match:\
-* reside in a package 'org.apache.flink.runtime.*' and contain any fields that 
are static, final, and of type InternalMiniClusterExtension and annotated with 
@RegisterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and contain any 
fields that are static, final, and of type MiniClusterExtension and annotated 
with @RegisterExtension or are , and of type MiniClusterTestEnvironment and 
annotated with @TestEnv\
-* reside in a package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class InternalMiniClusterExtension\
-* reside outside of package 'org.apache.flink.runtime.*' and is annotated with 
@ExtendWith with class MiniClusterExtension\
- or contain any fields that are public, static, and of type 
MiniClusterWithClientResource and final and annotated with @ClassRule or 
contain any fields that is of type MiniClusterWithClientResource and public and 
final and not static and annotated with @Rule
\ No newline at end of file
diff --git 
a/flink-table/flink-table-planner/archunit-violations/8905dbb5-c749-4c80-8848-c31e55f572f4
 
b/flink-table/flink-table-planner/archunit-violations/8905dbb5-c749-4c80-8848-c31e55f572f4
new file mode 100644
index 00000000000..e69de29bb2d
diff --git 
a/flink-table/flink-table-planner/archunit-violations/95e87b01-d1fe-4240-9e71-b8105bccba6a
 
b/flink-table/flink-table-planner/archunit-violations/95e87b01-d1fe-4240-9e71-b8105bccba6a
new file mode 100644
index 00000000000..e69de29bb2d
diff --git 
a/flink-table/flink-table-planner/archunit-violations/a17c9d3e-9546-4787-a16e-91f74fc9a335
 
b/flink-table/flink-table-planner/archunit-violations/a17c9d3e-9546-4787-a16e-91f74fc9a335
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/flink-table/flink-table-planner/archunit-violations/stored.rules 
b/flink-table/flink-table-planner/archunit-violations/stored.rules
new file mode 100644
index 00000000000..69446a62f8c
--- /dev/null
+++ b/flink-table/flink-table-planner/archunit-violations/stored.rules
@@ -0,0 +1,5 @@
+#
+#Sat Nov 25 01:49:59 CST 2023
+Junit4\ is\ forbidden,\ please\ use\ Junit5\ 
instead=a17c9d3e-9546-4787-a16e-91f74fc9a335
+Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ 
ITCase=95e87b01-d1fe-4240-9e71-b8105bccba6a
+ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ 
extension=8905dbb5-c749-4c80-8848-c31e55f572f4
diff --git a/flink-table/flink-table-planner/pom.xml 
b/flink-table/flink-table-planner/pom.xml
index 92895c2e01e..b43d6f241cc 100644
--- a/flink-table/flink-table-planner/pom.xml
+++ b/flink-table/flink-table-planner/pom.xml
@@ -150,6 +150,14 @@ under the License.
                        <scope>test</scope>
                </dependency>
 
+               <!-- ArchUit test dependencies -->
+               <dependency>
+                       <groupId>org.apache.flink</groupId>
+                       <artifactId>flink-architecture-tests-test</artifactId>
+                       <version>${project.version}</version>
+                       <scope>test</scope>
+               </dependency>
+
                <!-- Table API Scala dependencies -->
 
                <dependency>
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
new file mode 100644
index 00000000000..923a9dcea90
--- /dev/null
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.flink.architecture;
+
+import org.apache.flink.architecture.common.ImportOptions;
+import org.apache.flink.architecture.rules.BanJunit4Rules;
+
+import com.tngtech.archunit.core.importer.ImportOption;
+import com.tngtech.archunit.junit.AnalyzeClasses;
+import com.tngtech.archunit.junit.ArchTest;
+import com.tngtech.archunit.junit.ArchTests;
+
+/** Architecture tests for test code. */
+@AnalyzeClasses(
+        packages = {
+            "org.apache.flink.connector.file.table",
+            "org.apache.flink.formats.testcsv",
+            "org.apache.flink.table.api",
+            "org.apache.flink.table.planner",
+            "org.apache.flink.table.test",
+        },
+        importOptions = {
+            ImportOption.OnlyIncludeTests.class,
+            ImportOptions.ExcludeScalaImportOption.class,
+            ImportOptions.ExcludeShadedImportOption.class
+        })
+public class TestCodeArchitectureTest {
+
+    @ArchTest
+    public static final ArchTests COMMON_TESTS = 
ArchTests.in(TestCodeArchitectureTestBase.class);
+
+    @ArchTest public static final ArchTests BAN_JUNIT4_TESTS = 
ArchTests.in(BanJunit4Rules.class);
+}
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/catalog/CatalogITCase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/catalog/CatalogITCase.java
index 1f5926d3675..4753dce3855 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/catalog/CatalogITCase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/catalog/CatalogITCase.java
@@ -33,11 +33,13 @@ import 
org.apache.flink.table.catalog.GenericInMemoryCatalogFactoryOptions;
 import org.apache.flink.table.catalog.ObjectPath;
 import org.apache.flink.table.catalog.exceptions.CatalogException;
 import org.apache.flink.table.utils.CatalogManagerMocks;
+import org.apache.flink.test.junit5.MiniClusterExtension;
 import org.apache.flink.testutils.ClassLoaderUtils;
 import org.apache.flink.testutils.junit.utils.TempDirUtils;
 import org.apache.flink.util.TemporaryClassLoaderContext;
 
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
 
 import java.net.URLClassLoader;
@@ -51,6 +53,9 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 /** IT Case for catalog ddl. */
 class CatalogITCase {
 
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_RESOURCE = new 
MiniClusterExtension();
+
     @TempDir Path temporaryFolder;
 
     @Test
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInAggregateFunctionTestBase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInAggregateFunctionTestBase.java
index 961b69a8c03..e4e5d595e74 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInAggregateFunctionTestBase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInAggregateFunctionTestBase.java
@@ -41,7 +41,7 @@ import org.apache.flink.util.CloseableIterator;
 import org.apache.flink.util.Preconditions;
 
 import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.function.Executable;
 import org.junit.jupiter.api.parallel.Execution;
 import org.junit.jupiter.api.parallel.ExecutionMode;
@@ -66,9 +66,11 @@ import static org.assertj.core.api.Assertions.assertThat;
 /** Test base for testing aggregate {@link BuiltInFunctionDefinition built-in 
functions}. */
 @Execution(ExecutionMode.CONCURRENT)
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@ExtendWith(MiniClusterExtension.class)
 abstract class BuiltInAggregateFunctionTestBase {
 
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION = new 
MiniClusterExtension();
+
     abstract Stream<TestSpec> getTestCaseSpecs();
 
     final Stream<BuiltInFunctionTestBase.TestCase> getTestCases() {
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInFunctionTestBase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInFunctionTestBase.java
index da355199084..b7d0ae13294 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInFunctionTestBase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInFunctionTestBase.java
@@ -38,7 +38,7 @@ import org.apache.flink.util.CloseableIterator;
 import org.apache.flink.util.Preconditions;
 
 import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.function.Executable;
 import org.junit.jupiter.api.parallel.Execution;
 import org.junit.jupiter.api.parallel.ExecutionMode;
@@ -73,9 +73,11 @@ import static org.assertj.core.api.Assertions.catchThrowable;
  */
 @Execution(ExecutionMode.CONCURRENT)
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@ExtendWith(MiniClusterExtension.class)
 abstract class BuiltInFunctionTestBase {
 
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION = new 
MiniClusterExtension();
+
     Configuration getConfiguration() {
         return new Configuration();
     }
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/MatchRecognizeITCase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/MatchRecognizeITCase.java
index f18ab6acc9a..8efc072adfa 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/MatchRecognizeITCase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/MatchRecognizeITCase.java
@@ -29,12 +29,14 @@ import org.apache.flink.table.functions.AggregateFunction;
 import org.apache.flink.table.functions.FunctionContext;
 import org.apache.flink.table.functions.ScalarFunction;
 import 
org.apache.flink.table.planner.plan.utils.JavaUserDefinedAggFunctions.WeightedAvg;
+import org.apache.flink.test.junit5.MiniClusterExtension;
 import org.apache.flink.types.Row;
 import org.apache.flink.util.CollectionUtil;
 
 import org.apache.calcite.sql.SqlMatchRecognize;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.util.Comparator;
 import java.util.List;
@@ -49,6 +51,9 @@ import static org.assertj.core.api.Assertions.assertThat;
 /** IT Case for testing {@link SqlMatchRecognize}. */
 class MatchRecognizeITCase {
 
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION = new 
MiniClusterExtension();
+
     private StreamExecutionEnvironment env;
     private StreamTableEnvironment tEnv;
 
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicCtasITCaseBase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicCtasITCaseBase.java
index 341cc02d6c8..d50d2313675 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicCtasITCaseBase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicCtasITCaseBase.java
@@ -23,13 +23,14 @@ import org.apache.flink.table.api.config.TableConfigOptions;
 import org.apache.flink.table.connector.sink.abilities.SupportsStaging;
 import 
org.apache.flink.table.planner.factories.TestSupportsStagingTableFactory;
 import 
org.apache.flink.table.planner.factories.utils.TestCollectionTableFactory;
+import org.apache.flink.test.junit5.MiniClusterExtension;
 import org.apache.flink.types.Row;
 import org.apache.flink.util.FileUtils;
-import org.apache.flink.util.TestLogger;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
 
 import java.io.File;
@@ -42,7 +43,10 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 
 /** The base case of atomic ctas ITCase. */
-public abstract class AtomicCtasITCaseBase extends TestLogger {
+public abstract class AtomicCtasITCaseBase {
+
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION = new 
MiniClusterExtension();
 
     protected TableEnvironment tEnv;
 
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicRtasITCaseBase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicRtasITCaseBase.java
index 13b0e69125b..bdbb51d94f2 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicRtasITCaseBase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/AtomicRtasITCaseBase.java
@@ -24,13 +24,14 @@ import org.apache.flink.table.api.config.TableConfigOptions;
 import org.apache.flink.table.connector.sink.abilities.SupportsStaging;
 import 
org.apache.flink.table.planner.factories.TestSupportsStagingTableFactory;
 import 
org.apache.flink.table.planner.factories.utils.TestCollectionTableFactory;
+import org.apache.flink.test.junit5.MiniClusterExtension;
 import org.apache.flink.types.Row;
 import org.apache.flink.util.FileUtils;
-import org.apache.flink.util.TestLogger;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
 
 import java.io.File;
@@ -44,7 +45,10 @@ import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 /** The base case of atomic rtas ITCase. */
-public abstract class AtomicRtasITCaseBase extends TestLogger {
+public abstract class AtomicRtasITCaseBase {
+
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION = new 
MiniClusterExtension();
 
     protected TableEnvironment tEnv;
 
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/BatchAbstractTestBase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/BatchAbstractTestBase.java
index 6a6c17c0e72..676699c2027 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/BatchAbstractTestBase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/BatchAbstractTestBase.java
@@ -35,10 +35,10 @@ import java.nio.file.Path;
 /** Batch test base to use {@link RegisterExtension}. */
 public class BatchAbstractTestBase {
 
-    public static final int DEFAULT_PARALLELISM = 3;
+    protected static final int DEFAULT_PARALLELISM = 3;
 
     @RegisterExtension
-    public static MiniClusterExtension miniClusterResource =
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION =
             new MiniClusterExtension(
                     new MiniClusterResourceConfiguration.Builder()
                             .setConfiguration(getConfiguration())
@@ -46,7 +46,7 @@ public class BatchAbstractTestBase {
                             .setNumberSlotsPerTaskManager(DEFAULT_PARALLELISM)
                             .build());
 
-    @TempDir public static Path tmpDir;
+    @TempDir protected static Path tmpDir;
 
     private static Configuration getConfiguration() {
         Configuration config = new Configuration();
@@ -54,16 +54,16 @@ public class BatchAbstractTestBase {
         return config;
     }
 
-    public static File createTempFolder() throws IOException {
+    protected static File createTempFolder() throws IOException {
         return TempDirUtils.newFolder(BatchAbstractTestBase.tmpDir);
     }
 
-    public static File createTempFile() throws IOException {
+    protected static File createTempFile() throws IOException {
         Path tmpDirPath = createTempFolder().toPath();
         return TempDirUtils.newFile(tmpDirPath);
     }
 
-    public static File createFileInTempFolder(String fileName) throws 
IOException {
+    protected static File createFileInTempFolder(String fileName) throws 
IOException {
         Path tmpDirPath = createTempFolder().toPath();
         return TempDirUtils.newFile(tmpDirPath, fileName);
     }
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/JoinReorderITCaseBase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/JoinReorderITCaseBase.java
index a4f9673c50e..5b08b002701 100644
--- 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/JoinReorderITCaseBase.java
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/JoinReorderITCaseBase.java
@@ -18,6 +18,7 @@
 
 package org.apache.flink.table.planner.runtime.utils;
 
+import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
 import org.apache.flink.table.api.TableEnvironment;
 import org.apache.flink.table.api.config.ExecutionConfigOptions;
 import org.apache.flink.table.api.config.OptimizerConfigOptions;
@@ -30,10 +31,11 @@ import 
org.apache.flink.table.catalog.stats.CatalogColumnStatisticsDataBase;
 import org.apache.flink.table.catalog.stats.CatalogColumnStatisticsDataLong;
 import org.apache.flink.table.catalog.stats.CatalogTableStatistics;
 import org.apache.flink.table.planner.factories.TestValuesTableFactory;
-import org.apache.flink.util.TestLogger;
+import org.apache.flink.test.junit5.MiniClusterExtension;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
@@ -49,10 +51,18 @@ import java.util.Map;
  * org.apache.calcite.rel.rules.LoptOptimizeJoinRule} together by changing the 
factor
  * isBushyJoinReorder.
  */
-public abstract class JoinReorderITCaseBase extends TestLogger {
+public abstract class JoinReorderITCaseBase {
 
     private static final int DEFAULT_PARALLELISM = 4;
 
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION =
+            new MiniClusterExtension(
+                    new MiniClusterResourceConfiguration.Builder()
+                            .setNumberTaskManagers(1)
+                            .setNumberSlotsPerTaskManager(DEFAULT_PARALLELISM)
+                            .build());
+
     protected TableEnvironment tEnv;
     private Catalog catalog;
 
diff --git 
a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/StreamAbstractTestBase.java
 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/StreamAbstractTestBase.java
new file mode 100644
index 00000000000..cf9019786d5
--- /dev/null
+++ 
b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/utils/StreamAbstractTestBase.java
@@ -0,0 +1,38 @@
+/*
+ * 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.flink.table.planner.runtime.utils;
+
+import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
+import org.apache.flink.test.junit5.MiniClusterExtension;
+
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+/** Base class for unit tests that run multiple tests and want to reuse the 
same Flink cluster. */
+public class StreamAbstractTestBase {
+
+    private static final int DEFAULT_PARALLELISM = 4;
+
+    @RegisterExtension
+    private static final MiniClusterExtension MINI_CLUSTER_EXTENSION =
+            new MiniClusterExtension(
+                    new MiniClusterResourceConfiguration.Builder()
+                            .setNumberTaskManagers(1)
+                            .setNumberSlotsPerTaskManager(DEFAULT_PARALLELISM)
+                            .build());
+}
diff --git 
a/flink-table/flink-table-planner/src/test/resources/archunit.properties 
b/flink-table/flink-table-planner/src/test/resources/archunit.properties
new file mode 100644
index 00000000000..15be88c95ba
--- /dev/null
+++ b/flink-table/flink-table-planner/src/test/resources/archunit.properties
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+# By default we allow removing existing violations, but fail when new 
violations are added.
+freeze.store.default.allowStoreUpdate=true
+
+# Enable this if a new (frozen) rule has been added in order to create the 
initial store and record the existing violations.
+#freeze.store.default.allowStoreCreation=true
+
+# Enable this to add allow new violations to be recorded.
+# NOTE: Adding new violations should be avoided when possible. If the rule was 
correct to flag a new
+#       violation, please try to avoid creating the violation. If the 
violation was created due to a
+#       shortcoming of the rule, file a JIRA issue so the rule can be improved.
+#freeze.refreeze=true
+
+freeze.store.default.path=archunit-violations
diff --git 
a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingTestBase.scala
 
b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingTestBase.scala
index 526837a526d..aeea77068a6 100644
--- 
a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingTestBase.scala
+++ 
b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingTestBase.scala
@@ -17,21 +17,18 @@
  */
 package org.apache.flink.table.planner.runtime.utils
 
-import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration
 import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
 import org.apache.flink.table.api.{EnvironmentSettings, 
ImplicitExpressionConversions}
 import org.apache.flink.table.api.bridge.scala.StreamTableEnvironment
 import org.apache.flink.table.planner.factories.TestValuesTableFactory
-import org.apache.flink.test.junit5.MiniClusterExtension
 import org.apache.flink.types.Row
 
 import org.junit.jupiter.api.{AfterEach, BeforeEach}
-import org.junit.jupiter.api.extension.RegisterExtension
 import org.junit.jupiter.api.io.TempDir
 
 import java.nio.file.Path
 
-class StreamingTestBase {
+class StreamingTestBase extends StreamAbstractTestBase {
 
   var env: StreamExecutionEnvironment = _
   var tEnv: StreamTableEnvironment = _
@@ -68,13 +65,3 @@ class StreamingTestBase {
     row
   }
 }
-
-object StreamingTestBase extends StreamingTestBase {
-  @RegisterExtension
-  private val _: MiniClusterExtension = new MiniClusterExtension(
-    () =>
-      new MiniClusterResourceConfiguration.Builder()
-        .setNumberTaskManagers(1)
-        .setNumberSlotsPerTaskManager(4)
-        .build())
-}
diff --git 
a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingWithStateTestBase.scala
 
b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingWithStateTestBase.scala
index 620a56835ae..249d42dc197 100644
--- 
a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingWithStateTestBase.scala
+++ 
b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/utils/StreamingWithStateTestBase.scala
@@ -63,7 +63,7 @@ class StreamingWithStateTestBase(state: StateBackendMode) 
extends StreamingTestB
   override def before(): Unit = {
     super.before()
     // set state backend
-    baseCheckpointPath = TempDirUtils.newFolder(tempFolder).getAbsoluteFile
+    baseCheckpointPath = tempFolder.toFile
     state match {
       case HEAP_BACKEND =>
         val conf = new Configuration()


Reply via email to