You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ai...@apache.org on 2022/01/31 09:01:08 UTC

[flink] branch master updated (3144fae -> 4f62408)

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

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


    from 3144fae  [FLINK-25771][connectors][Cassandra][test] Add a test that raiseCassandraRequestsTimeouts indeed changes the configuration inside the container.
     new c132595  [FLINK-25220][test] update flink pom for ArchUnit test infra
     new bde48e9  [FLINK-25220][test] Split architecture-tests and build ArchUnit extension
     new d7c0753  [FLINK-25220][test] develop ArchUnit rules and test base for ITCase
     new 8a0b1c0  [FLINK-25220][test] ITCase ArchUnit test for HBase-2.2 connector
     new 2dae76e  [FLINK-25220][test] ITCase ArchUnit test for files connector
     new 4f62408  [FLINK-25220][test] update README.md

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 flink-architecture-tests/README.md                 |  48 ++-
 .../flink-architecture-tests-base/pom.xml          |  46 ++
 .../flink/architecture/common/Conditions.java      |   0
 .../architecture/common/GivenJavaClasses.java      |   0
 .../flink/architecture/common/ImportOptions.java}  |  31 +-
 .../architecture/common/JavaFieldPredicates.java   | 104 +++++
 .../flink/architecture/common/Predicates.java      | 149 +++++++
 .../architecture/common/SourcePredicates.java      |  20 +-
 .../flink-architecture-tests-production/README.md  |  33 ++
 .../18509c9e-3250-4c52-91b9-11ccefc85db1           |   0
 .../52c5c6a1-204f-462d-9efa-4ffcb100fb4d           |   0
 .../5b9eed8a-5fb6-4373-98ac-3be2a71941b8           |   0
 .../7602816f-5c01-4b7a-9e3e-235dfedec245           |   0
 .../e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5           |   0
 .../e577412e-8d38-496c-a680-b842112e4b94           |   0
 .../archunit-violations}/stored.rules              |   0
 .../pom.xml                                        |  77 +---
 .../flink/architecture/ArchitectureTest.java       |  43 ++
 .../architecture/rules/ApiAnnotationRules.java     |   0
 .../flink/architecture/rules/TableApiRules.java    |   0
 .../src/test/resources/archunit.properties         |   5 +-
 .../src/test/resources/log4j2-test.properties}     |  18 +-
 .../flink-architecture-tests-test/README.md        |  57 +++
 .../flink-architecture-tests-test/pom.xml          | 102 +++++
 .../architecture/TestCodeArchitectureTestBase.java |  36 ++
 .../flink/architecture/rules/ITCaseRules.java      |  91 ++++
 .../src/test/resources/archunit.properties         |   5 +-
 .../src/test/resources/log4j2-test.properties}     |  18 +-
 flink-architecture-tests/pom.xml                   | 462 +++++++++++----------
 .../flink/architecture/common/Predicates.java      |  54 ---
 .../9e170923-1a49-45b4-8dc1-1ad7858a2357           |   3 +
 .../a2441212-ec8c-494d-9a3f-cc334599c116           |   0
 .../archunit-violations/stored.rules               |   4 +
 flink-connectors/flink-connector-files/pom.xml     |   8 +
 .../architecture/TestCodeArchitectureTest.java     |  40 ++
 .../src/test/resources/archunit.properties         |   5 +-
 .../3688e857-50b4-4310-b42c-4280c66dc351           |   0
 .../bed6cd0b-4684-4af5-ae26-8400fd99c2dd           |   0
 .../archunit-violations/stored.rules               |   4 +
 flink-connectors/flink-connector-hbase-2.2/pom.xml |   9 +
 .../architecture/TestCodeArchitectureTest.java     |  40 ++
 .../src/test/resources/archunit.properties         |   5 +-
 pom.xml                                            |  35 +-
 43 files changed, 1134 insertions(+), 418 deletions(-)
 create mode 100644 flink-architecture-tests/flink-architecture-tests-base/pom.xml
 rename flink-architecture-tests/{src/test => flink-architecture-tests-base/src/main}/java/org/apache/flink/architecture/common/Conditions.java (100%)
 rename flink-architecture-tests/{src/test => flink-architecture-tests-base/src/main}/java/org/apache/flink/architecture/common/GivenJavaClasses.java (100%)
 rename flink-architecture-tests/{src/test/java/org/apache/flink/architecture/ArchitectureTest.java => flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/ImportOptions.java} (62%)
 create mode 100644 flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/JavaFieldPredicates.java
 create mode 100644 flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/Predicates.java
 rename flink-architecture-tests/{src/test => flink-architecture-tests-base/src/main}/java/org/apache/flink/architecture/common/SourcePredicates.java (79%)
 create mode 100644 flink-architecture-tests/flink-architecture-tests-production/README.md
 rename flink-architecture-tests/{violations => flink-architecture-tests-production/archunit-violations}/18509c9e-3250-4c52-91b9-11ccefc85db1 (100%)
 rename flink-architecture-tests/{violations => flink-architecture-tests-production/archunit-violations}/52c5c6a1-204f-462d-9efa-4ffcb100fb4d (100%)
 rename flink-architecture-tests/{violations => flink-architecture-tests-production/archunit-violations}/5b9eed8a-5fb6-4373-98ac-3be2a71941b8 (100%)
 rename flink-architecture-tests/{violations => flink-architecture-tests-production/archunit-violations}/7602816f-5c01-4b7a-9e3e-235dfedec245 (100%)
 rename flink-architecture-tests/{violations => flink-architecture-tests-production/archunit-violations}/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5 (100%)
 rename flink-architecture-tests/{violations => flink-architecture-tests-production/archunit-violations}/e577412e-8d38-496c-a680-b842112e4b94 (100%)
 rename flink-architecture-tests/{violations => flink-architecture-tests-production/archunit-violations}/stored.rules (100%)
 copy flink-architecture-tests/{ => flink-architecture-tests-production}/pom.xml (71%)
 create mode 100644 flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/ArchitectureTest.java
 rename flink-architecture-tests/{ => flink-architecture-tests-production}/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java (100%)
 rename flink-architecture-tests/{ => flink-architecture-tests-production}/src/test/java/org/apache/flink/architecture/rules/TableApiRules.java (100%)
 copy flink-architecture-tests/{ => flink-architecture-tests-production}/src/test/resources/archunit.properties (85%)
 copy flink-architecture-tests/{src/test/resources/archunit.properties => flink-architecture-tests-production/src/test/resources/log4j2-test.properties} (59%)
 create mode 100644 flink-architecture-tests/flink-architecture-tests-test/README.md
 create mode 100644 flink-architecture-tests/flink-architecture-tests-test/pom.xml
 create mode 100644 flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/TestCodeArchitectureTestBase.java
 create mode 100644 flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/rules/ITCaseRules.java
 copy flink-architecture-tests/{ => flink-architecture-tests-test}/src/test/resources/archunit.properties (85%)
 copy flink-architecture-tests/{src/test/resources/archunit.properties => flink-architecture-tests-test/src/test/resources/log4j2-test.properties} (59%)
 delete mode 100644 flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Predicates.java
 create mode 100644 flink-connectors/flink-connector-files/archunit-violations/9e170923-1a49-45b4-8dc1-1ad7858a2357
 copy flink-yarn/src/test/resources/krb5.keytab => flink-connectors/flink-connector-files/archunit-violations/a2441212-ec8c-494d-9a3f-cc334599c116 (100%)
 create mode 100644 flink-connectors/flink-connector-files/archunit-violations/stored.rules
 create mode 100644 flink-connectors/flink-connector-files/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
 copy {flink-architecture-tests => flink-connectors/flink-connector-files}/src/test/resources/archunit.properties (85%)
 copy flink-yarn/src/test/resources/krb5.keytab => flink-connectors/flink-connector-hbase-2.2/archunit-violations/3688e857-50b4-4310-b42c-4280c66dc351 (100%)
 copy flink-yarn/src/test/resources/krb5.keytab => flink-connectors/flink-connector-hbase-2.2/archunit-violations/bed6cd0b-4684-4af5-ae26-8400fd99c2dd (100%)
 create mode 100644 flink-connectors/flink-connector-hbase-2.2/archunit-violations/stored.rules
 create mode 100644 flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
 rename {flink-architecture-tests => flink-connectors/flink-connector-hbase-2.2}/src/test/resources/archunit.properties (85%)

[flink] 05/06: [FLINK-25220][test] ITCase ArchUnit test for files connector

Posted by ai...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2dae76e135eb076d007b193bbf61a32ca4d0e838
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Thu Jan 20 21:16:10 2022 +0100

    [FLINK-25220][test] ITCase ArchUnit test for files connector
---
 .../9e170923-1a49-45b4-8dc1-1ad7858a2357           |  3 ++
 .../a2441212-ec8c-494d-9a3f-cc334599c116           |  0
 .../archunit-violations/stored.rules               |  4 +++
 flink-connectors/flink-connector-files/pom.xml     |  8 +++++
 .../architecture/TestCodeArchitectureTest.java     | 40 ++++++++++++++++++++++
 .../src/test/resources/archunit.properties         | 31 +++++++++++++++++
 6 files changed, 86 insertions(+)

diff --git a/flink-connectors/flink-connector-files/archunit-violations/9e170923-1a49-45b4-8dc1-1ad7858a2357 b/flink-connectors/flink-connector-files/archunit-violations/9e170923-1a49-45b4-8dc1-1ad7858a2357
new file mode 100644
index 0000000..63dcecb
--- /dev/null
+++ b/flink-connectors/flink-connector-files/archunit-violations/9e170923-1a49-45b4-8dc1-1ad7858a2357
@@ -0,0 +1,3 @@
+org.apache.flink.connector.file.sink.BatchExecutionFileSinkITCase does not satisfy: contain any fields that are public, static, and of type MiniClusterExtension and final and contain any fields that are public, static, and of type AllCallbackWrapper and final and annotated with @RegisterExtension 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 MiniClusterWithClientResour [...]
+org.apache.flink.connector.file.sink.StreamingExecutionFileSinkITCase does not satisfy: contain any fields that are public, static, and of type MiniClusterExtension and final and contain any fields that are public, static, and of type AllCallbackWrapper and final and annotated with @RegisterExtension 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 MiniClusterWithClientRe [...]
+org.apache.flink.connector.file.sink.writer.FileSinkMigrationITCase does not satisfy: contain any fields that are public, static, and of type MiniClusterExtension and final and contain any fields that are public, static, and of type AllCallbackWrapper and final and annotated with @RegisterExtension 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 MiniClusterWithClientReso [...]
\ No newline at end of file
diff --git a/flink-connectors/flink-connector-files/archunit-violations/a2441212-ec8c-494d-9a3f-cc334599c116 b/flink-connectors/flink-connector-files/archunit-violations/a2441212-ec8c-494d-9a3f-cc334599c116
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connectors/flink-connector-files/archunit-violations/stored.rules b/flink-connectors/flink-connector-files/archunit-violations/stored.rules
new file mode 100644
index 0000000..216fb1b
--- /dev/null
+++ b/flink-connectors/flink-connector-files/archunit-violations/stored.rules
@@ -0,0 +1,4 @@
+#
+#Thu Jan 20 17:27:26 CET 2022
+classes\ that\ are\ Java\ classes\ and\ have\ simple\ name\ ending\ with\ 'ITCase'\ and\ are\ top\ level\ classes\ and\ do\ not\ have\ modifier\ ABSTRACT\ should\ contain\ any\ fields\ that\ are\ public,\ static,\ and\ of\ type\ MiniClusterExtension\ and\ final\ and\ contain\ any\ fields\ that\ are\ public,\ static,\ and\ of\ type\ AllCallbackWrapper\ and\ final\ and\ annotated\ with\ @RegisterExtension\ or\ contain\ any\ fields\ that\ are\ public,\ static,\ and\ of\ type\ MiniClusterWit [...]
+classes\ that\ are\ Java\ classes\ and\ are\ assignable\ to\ org.apache.flink.test.util.AbstractTestBase\ and\ do\ not\ have\ modifier\ ABSTRACT\ should\ have\ simple\ name\ ending\ with\ 'ITCase'=a2441212-ec8c-494d-9a3f-cc334599c116
diff --git a/flink-connectors/flink-connector-files/pom.xml b/flink-connectors/flink-connector-files/pom.xml
index 4bbc25d..2a0ed9d 100644
--- a/flink-connectors/flink-connector-files/pom.xml
+++ b/flink-connectors/flink-connector-files/pom.xml
@@ -113,6 +113,14 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- ArchUit test dependencies -->
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-architecture-tests-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+
 	</dependencies>
 
 	<build>
diff --git a/flink-connectors/flink-connector-files/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java b/flink-connectors/flink-connector-files/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
new file mode 100644
index 0000000..858cbd1
--- /dev/null
+++ b/flink-connectors/flink-connector-files/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 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",
+        importOptions = {
+            ImportOption.OnlyIncludeTests.class,
+            ImportOptions.ExcludeScalaImportOption.class,
+            ImportOptions.ExcludeShadedImportOption.class
+        })
+public class TestCodeArchitectureTest {
+
+    @ArchTest
+    public static final ArchTests COMMON_TESTS = ArchTests.in(TestCodeArchitectureTestBase.class);
+}
diff --git a/flink-connectors/flink-connector-files/src/test/resources/archunit.properties b/flink-connectors/flink-connector-files/src/test/resources/archunit.properties
new file mode 100644
index 0000000..15be88c
--- /dev/null
+++ b/flink-connectors/flink-connector-files/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

[flink] 02/06: [FLINK-25220][test] Split architecture-tests and build ArchUnit extension

Posted by ai...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit bde48e96d8f99a011fe11d3127af76db72488f3f
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Thu Jan 20 10:40:59 2022 +0100

    [FLINK-25220][test] Split architecture-tests and build ArchUnit extension
    
    - create submodule flink-architecture-tests-base, flink-architecture-tests-production, flink-architecture-tests-test
    - build ArchUnit extension and move the common part to the flink-architecture-tests-base submodule
    - refactoring and move ArchUnit tests and rules to the flink-architecture-tests-production submodule
---
 .../flink-architecture-tests-base/pom.xml          |  46 ++
 .../flink/architecture/common/Conditions.java      |   0
 .../architecture/common/GivenJavaClasses.java      |   0
 .../flink/architecture/common/ImportOptions.java}  |  31 +-
 .../architecture/common/JavaFieldPredicates.java   | 104 +++++
 .../flink/architecture/common/Predicates.java      | 149 +++++++
 .../architecture/common/SourcePredicates.java      |  20 +-
 .../18509c9e-3250-4c52-91b9-11ccefc85db1           |   0
 .../52c5c6a1-204f-462d-9efa-4ffcb100fb4d           |   0
 .../5b9eed8a-5fb6-4373-98ac-3be2a71941b8           |   0
 .../7602816f-5c01-4b7a-9e3e-235dfedec245           |   0
 .../e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5           |   0
 .../e577412e-8d38-496c-a680-b842112e4b94           |   0
 .../archunit-violations}/stored.rules              |   0
 .../pom.xml                                        |  77 +---
 .../flink/architecture/ArchitectureTest.java       |  43 ++
 .../architecture/rules/ApiAnnotationRules.java     |   0
 .../flink/architecture/rules/TableApiRules.java    |   0
 .../src/test/resources/archunit.properties         |  31 ++
 .../src/test/resources/log4j2-test.properties      |  28 ++
 .../flink-architecture-tests-test/pom.xml          |  83 ++++
 flink-architecture-tests/pom.xml                   | 462 +++++++++++----------
 .../flink/architecture/common/Predicates.java      |  54 ---
 23 files changed, 750 insertions(+), 378 deletions(-)

diff --git a/flink-architecture-tests/flink-architecture-tests-base/pom.xml b/flink-architecture-tests/flink-architecture-tests-base/pom.xml
new file mode 100644
index 0000000..53f61c8
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-base/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.flink</groupId>
+		<artifactId>flink-architecture-tests</artifactId>
+		<version>1.15-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+
+	<artifactId>flink-architecture-tests-base</artifactId>
+	<name>Flink : Architecture Tests : Base</name>
+
+	<packaging>jar</packaging>
+
+	<dependencies>
+		<dependency>
+			<groupId>com.tngtech.archunit</groupId>
+			<artifactId>archunit</artifactId>
+			<scope>compile</scope>
+		</dependency>
+	</dependencies>
+
+</project>
diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Conditions.java b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/Conditions.java
similarity index 100%
rename from flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Conditions.java
rename to flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/Conditions.java
diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/GivenJavaClasses.java b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/GivenJavaClasses.java
similarity index 100%
rename from flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/GivenJavaClasses.java
rename to flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/GivenJavaClasses.java
diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/ArchitectureTest.java b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/ImportOptions.java
similarity index 62%
rename from flink-architecture-tests/src/test/java/org/apache/flink/architecture/ArchitectureTest.java
rename to flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/ImportOptions.java
index 00a2c36..93eed90 100644
--- a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/ArchitectureTest.java
+++ b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/ImportOptions.java
@@ -16,36 +16,15 @@
  * limitations under the License.
  */
 
-package org.apache.flink.architecture;
-
-import org.apache.flink.architecture.common.GivenJavaClasses;
-import org.apache.flink.architecture.common.SourcePredicates;
-import org.apache.flink.architecture.rules.ApiAnnotationRules;
-import org.apache.flink.architecture.rules.TableApiRules;
+package org.apache.flink.architecture.common;
 
 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.ArchTests;
 
 import java.util.regex.Pattern;
 
-/** Architecture tests. */
-@AnalyzeClasses(
-        packages = "org.apache.flink",
-        importOptions = {
-            ImportOption.DoNotIncludeTests.class,
-            ArchitectureTest.ExcludeScalaImportOption.class,
-            ArchitectureTest.ExcludeShadedImportOption.class
-        })
-public class ArchitectureTest {
-    @ArchTest
-    public static final ArchTests API_ANNOTATIONS = ArchTests.in(ApiAnnotationRules.class);
-
-    @ArchTest public static final ArchTests TABLE_API = ArchTests.in(TableApiRules.class);
-
-    // ---------------------------------------------------------------------------------------------
+/** Provide the most used {@link ImportOption}. */
+public class ImportOptions {
 
     /**
      * Excludes Scala classes on a best-effort basis.
@@ -55,7 +34,7 @@ public class ArchitectureTest {
      * GivenJavaClasses} or {@link SourcePredicates#areJavaClasses()} should be used in rules as
      * well.
      */
-    static class ExcludeScalaImportOption implements ImportOption {
+    public static final class ExcludeScalaImportOption implements ImportOption {
         private static final Pattern SCALA = Pattern.compile(".*/scala/.*");
 
         @Override
@@ -70,7 +49,7 @@ public class ArchitectureTest {
      * <p>This is not only important to exclude external code shaded into a package like {@code
      * org.apache.flink.shaded.*} from being tested, but crucial for memory consumption.
      */
-    static class ExcludeShadedImportOption implements ImportOption {
+    public static final class ExcludeShadedImportOption implements ImportOption {
         private static final Pattern SHADED = Pattern.compile(".*/shaded/.*");
 
         @Override
diff --git a/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/JavaFieldPredicates.java b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/JavaFieldPredicates.java
new file mode 100644
index 0000000..36a5e66
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/JavaFieldPredicates.java
@@ -0,0 +1,104 @@
+/*
+ * 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.common;
+
+import com.tngtech.archunit.base.DescribedPredicate;
+import com.tngtech.archunit.core.domain.JavaField;
+import com.tngtech.archunit.core.domain.JavaModifier;
+
+import java.lang.annotation.Annotation;
+
+/** Fine-grained predicates focus on the JavaField. */
+public class JavaFieldPredicates {
+
+    /**
+     * Match the public modifier of the {@link JavaField}.
+     *
+     * @return A {@link DescribedPredicate} returning true, if and only if the tested {@link
+     *     JavaField} has the public modifier.
+     */
+    public static DescribedPredicate<JavaField> isPublic() {
+        return DescribedPredicate.describe(
+                "public", field -> field.getModifiers().contains(JavaModifier.PUBLIC));
+    }
+
+    /**
+     * Match the static modifier of the {@link JavaField}.
+     *
+     * @return A {@link DescribedPredicate} returning true, if and only if the tested {@link
+     *     JavaField} has the static modifier.
+     */
+    public static DescribedPredicate<JavaField> isStatic() {
+        return DescribedPredicate.describe(
+                "static", field -> field.getModifiers().contains(JavaModifier.STATIC));
+    }
+
+    /**
+     * Match none static modifier of the {@link JavaField}.
+     *
+     * @return A {@link DescribedPredicate} returning true, if and only if the tested {@link
+     *     JavaField} has no static modifier.
+     */
+    public static DescribedPredicate<JavaField> isNotStatic() {
+        return DescribedPredicate.describe(
+                "not static", field -> !field.getModifiers().contains(JavaModifier.STATIC));
+    }
+
+    /**
+     * Match the final modifier of the {@link JavaField}.
+     *
+     * @return A {@link DescribedPredicate} returning true, if and only if the tested {@link
+     *     JavaField} has the final modifier.
+     */
+    public static DescribedPredicate<JavaField> isFinal() {
+        return DescribedPredicate.describe(
+                "final", field -> field.getModifiers().contains(JavaModifier.FINAL));
+    }
+
+    /**
+     * Match the {@link Class} of the {@link JavaField}.
+     *
+     * @return A {@link DescribedPredicate} returning true, if and only if the tested {@link
+     *     JavaField} has the same type of the given {@code clazz}.
+     */
+    public static DescribedPredicate<JavaField> ofType(Class<?> clazz) {
+        return DescribedPredicate.describe(
+                "of type " + clazz.getSimpleName(),
+                field -> field.getRawType().isEquivalentTo(clazz));
+    }
+
+    /**
+     * Match the single Annotation of the {@link JavaField}.
+     *
+     * @return A {@link DescribedPredicate} returning true, if and only if the tested {@link
+     *     JavaField} has exactly the given Annotation {@code annotationType}.
+     */
+    public static DescribedPredicate<JavaField> annotatedWith(
+            Class<? extends Annotation> annotationType) {
+        return DescribedPredicate.describe(
+                "annotated with @" + annotationType.getSimpleName(),
+                field ->
+                        field.getAnnotations().size() == 1
+                                && field.getAnnotations()
+                                        .iterator()
+                                        .next()
+                                        .getRawType()
+                                        .isEquivalentTo(annotationType));
+    }
+}
diff --git a/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/Predicates.java b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/Predicates.java
new file mode 100644
index 0000000..fac5693
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/Predicates.java
@@ -0,0 +1,149 @@
+/*
+ * 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.common;
+
+import com.tngtech.archunit.base.ChainableFunction;
+import com.tngtech.archunit.base.DescribedPredicate;
+import com.tngtech.archunit.base.Function;
+import com.tngtech.archunit.core.domain.JavaClass;
+import com.tngtech.archunit.core.domain.JavaField;
+import com.tngtech.archunit.core.domain.JavaModifier;
+import com.tngtech.archunit.core.domain.properties.CanBeAnnotated;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Set;
+
+import static com.tngtech.archunit.lang.conditions.ArchPredicates.is;
+import static org.apache.flink.architecture.common.JavaFieldPredicates.annotatedWith;
+import static org.apache.flink.architecture.common.JavaFieldPredicates.isFinal;
+import static org.apache.flink.architecture.common.JavaFieldPredicates.isNotStatic;
+import static org.apache.flink.architecture.common.JavaFieldPredicates.isPublic;
+import static org.apache.flink.architecture.common.JavaFieldPredicates.ofType;
+
+/** Common predicates for architecture tests. */
+public class Predicates {
+
+    @SafeVarargs
+    public static DescribedPredicate<JavaClass> areDirectlyAnnotatedWithAtLeastOneOf(
+            Class<? extends Annotation>... annotations) {
+        return Arrays.stream(annotations)
+                .map(CanBeAnnotated.Predicates::annotatedWith)
+                .reduce(DescribedPredicate::or)
+                .orElseThrow(IllegalArgumentException::new)
+                .forSubtype();
+    }
+
+    /**
+     * @return A {@link DescribedPredicate} returning true, if and only if the predicate {@link
+     *     JavaField} could be found in the {@link JavaClass}.
+     */
+    public static DescribedPredicate<JavaClass> containAnyFieldsInClassHierarchyThat(
+            DescribedPredicate<? super JavaField> predicate) {
+        return new ContainAnyFieldsThatPredicate<>(
+                "fields",
+                new ChainableFunction<JavaClass, Set<JavaField>>() {
+                    @Override
+                    public Set<JavaField> apply(JavaClass input) {
+                        // need to get all fields with the inheritance hierarchy
+                        return input.getAllFields();
+                    }
+                },
+                predicate);
+    }
+
+    /**
+     * Tests that the given field is {@code public static} and of the given type {@code clazz} .
+     *
+     * <p>Attention: changing the description will add a rule into the stored.rules.
+     */
+    public static DescribedPredicate<JavaField> arePublicStaticOfType(Class<?> clazz) {
+        return DescribedPredicate.describe(
+                "are public, static, and of type " + clazz.getSimpleName(),
+                field ->
+                        field.getModifiers().contains(JavaModifier.PUBLIC)
+                                && field.getModifiers().contains(JavaModifier.STATIC)
+                                && field.getRawType().isEquivalentTo(clazz));
+    }
+
+    /**
+     * Tests that the given field is {@code public final} and not {@code static} and of the given
+     * type {@code clazz} .
+     */
+    public static DescribedPredicate<JavaField> arePublicFinalOfType(Class<?> clazz) {
+        return is(ofType(clazz)).and(isPublic()).and(isFinal()).and(isNotStatic());
+    }
+
+    /**
+     * Tests that the given field is {@code public static final} and of the given type {@code clazz}
+     * .
+     */
+    public static DescribedPredicate<JavaField> arePublicStaticFinalOfType(Class<?> clazz) {
+        return arePublicStaticOfType(clazz).and(isFinal());
+    }
+
+    /**
+     * Tests that the given field is {@code public final} and of the given type {@code clazz} with
+     * exactly the given {@code annotationType}.
+     */
+    public static DescribedPredicate<JavaField> arePublicFinalOfTypeWithAnnotation(
+            Class<?> clazz, Class<? extends Annotation> annotationType) {
+        return arePublicFinalOfType(clazz).and(annotatedWith(annotationType));
+    }
+
+    /**
+     * Tests that the given field is {@code public static final} and of the given type {@code clazz}
+     * with exactly the given {@code annotationType}.
+     */
+    public static DescribedPredicate<JavaField> arePublicStaticFinalOfTypeWithAnnotation(
+            Class<?> clazz, Class<? extends Annotation> annotationType) {
+        return arePublicStaticFinalOfType(clazz).and(annotatedWith(annotationType));
+    }
+
+    private Predicates() {}
+
+    /**
+     * A predicate to determine if a {@link JavaClass} contains one or more {@link JavaField }
+     * matching the supplied predicate.
+     */
+    private static class ContainAnyFieldsThatPredicate<T extends JavaField>
+            extends DescribedPredicate<JavaClass> {
+        private final Function<JavaClass, Set<T>> getFields;
+        private final DescribedPredicate<? super T> predicate;
+
+        ContainAnyFieldsThatPredicate(
+                String fieldDescription,
+                Function<JavaClass, Set<T>> getFields,
+                DescribedPredicate<? super T> predicate) {
+            super("contain any " + fieldDescription + " that " + predicate.getDescription());
+            this.getFields = getFields;
+            this.predicate = predicate;
+        }
+
+        @Override
+        public boolean apply(JavaClass input) {
+            for (T member : getFields.apply(input)) {
+                if (predicate.apply(member)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}
diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/SourcePredicates.java b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/SourcePredicates.java
similarity index 79%
rename from flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/SourcePredicates.java
rename to flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/SourcePredicates.java
index 1b9c339..24b63d9 100644
--- a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/SourcePredicates.java
+++ b/flink-architecture-tests/flink-architecture-tests-base/src/main/java/org/apache/flink/architecture/common/SourcePredicates.java
@@ -21,9 +21,11 @@ package org.apache.flink.architecture.common;
 import com.tngtech.archunit.base.DescribedPredicate;
 import com.tngtech.archunit.core.domain.JavaClass;
 import com.tngtech.archunit.core.domain.Source;
+import com.tngtech.archunit.core.importer.ImportOption;
 import com.tngtech.archunit.core.importer.Location;
 
 import static com.tngtech.archunit.core.importer.ImportOption.Predefined.DO_NOT_INCLUDE_TESTS;
+import static com.tngtech.archunit.core.importer.ImportOption.Predefined.ONLY_INCLUDE_TESTS;
 
 /** Predicates for a {@link JavaClass}'s {@link Source}. */
 public class SourcePredicates {
@@ -34,13 +36,27 @@ public class SourcePredicates {
      * <p>This check is best-effort only.
      */
     public static DescribedPredicate<JavaClass> areProductionCode() {
-        return new DescribedPredicate<JavaClass>("are production code") {
+        return targetCode(DO_NOT_INCLUDE_TESTS, "are production code");
+    }
+
+    /**
+     * Passes if and only if the given class is from test code.
+     *
+     * <p>This check is best-effort only.
+     */
+    public static DescribedPredicate<JavaClass> areTestCode() {
+        return targetCode(ONLY_INCLUDE_TESTS, "are test code");
+    }
+
+    private static DescribedPredicate<JavaClass> targetCode(
+            ImportOption.Predefined predicates, String description) {
+        return new DescribedPredicate<JavaClass>(description) {
             @Override
             public boolean apply(JavaClass clazz) {
                 return clazz.getSource()
                         .map(Source::getUri)
                         .map(Location::of)
-                        .map(DO_NOT_INCLUDE_TESTS::includes)
+                        .map(predicates::includes)
                         .orElse(false);
             }
         };
diff --git a/flink-architecture-tests/violations/18509c9e-3250-4c52-91b9-11ccefc85db1 b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/18509c9e-3250-4c52-91b9-11ccefc85db1
similarity index 100%
rename from flink-architecture-tests/violations/18509c9e-3250-4c52-91b9-11ccefc85db1
rename to flink-architecture-tests/flink-architecture-tests-production/archunit-violations/18509c9e-3250-4c52-91b9-11ccefc85db1
diff --git a/flink-architecture-tests/violations/52c5c6a1-204f-462d-9efa-4ffcb100fb4d b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/52c5c6a1-204f-462d-9efa-4ffcb100fb4d
similarity index 100%
rename from flink-architecture-tests/violations/52c5c6a1-204f-462d-9efa-4ffcb100fb4d
rename to flink-architecture-tests/flink-architecture-tests-production/archunit-violations/52c5c6a1-204f-462d-9efa-4ffcb100fb4d
diff --git a/flink-architecture-tests/violations/5b9eed8a-5fb6-4373-98ac-3be2a71941b8 b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/5b9eed8a-5fb6-4373-98ac-3be2a71941b8
similarity index 100%
rename from flink-architecture-tests/violations/5b9eed8a-5fb6-4373-98ac-3be2a71941b8
rename to flink-architecture-tests/flink-architecture-tests-production/archunit-violations/5b9eed8a-5fb6-4373-98ac-3be2a71941b8
diff --git a/flink-architecture-tests/violations/7602816f-5c01-4b7a-9e3e-235dfedec245 b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/7602816f-5c01-4b7a-9e3e-235dfedec245
similarity index 100%
rename from flink-architecture-tests/violations/7602816f-5c01-4b7a-9e3e-235dfedec245
rename to flink-architecture-tests/flink-architecture-tests-production/archunit-violations/7602816f-5c01-4b7a-9e3e-235dfedec245
diff --git a/flink-architecture-tests/violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5 b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
similarity index 100%
rename from flink-architecture-tests/violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
rename to flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
diff --git a/flink-architecture-tests/violations/e577412e-8d38-496c-a680-b842112e4b94 b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e577412e-8d38-496c-a680-b842112e4b94
similarity index 100%
rename from flink-architecture-tests/violations/e577412e-8d38-496c-a680-b842112e4b94
rename to flink-architecture-tests/flink-architecture-tests-production/archunit-violations/e577412e-8d38-496c-a680-b842112e4b94
diff --git a/flink-architecture-tests/violations/stored.rules b/flink-architecture-tests/flink-architecture-tests-production/archunit-violations/stored.rules
similarity index 100%
rename from flink-architecture-tests/violations/stored.rules
rename to flink-architecture-tests/flink-architecture-tests-production/archunit-violations/stored.rules
diff --git a/flink-architecture-tests/pom.xml b/flink-architecture-tests/flink-architecture-tests-production/pom.xml
similarity index 71%
copy from flink-architecture-tests/pom.xml
copy to flink-architecture-tests/flink-architecture-tests-production/pom.xml
index 5521684..751a056 100644
--- a/flink-architecture-tests/pom.xml
+++ b/flink-architecture-tests/flink-architecture-tests-production/pom.xml
@@ -25,40 +25,35 @@ under the License.
 
 	<parent>
 		<groupId>org.apache.flink</groupId>
-		<artifactId>flink-parent</artifactId>
+		<artifactId>flink-architecture-tests</artifactId>
 		<version>1.15-SNAPSHOT</version>
-		<relativePath>..</relativePath>
+		<relativePath>../pom.xml</relativePath>
 	</parent>
 
-	<artifactId>flink-architecture-tests</artifactId>
-	<name>Flink : Architecture Tests</name>
+	<artifactId>flink-architecture-tests-production</artifactId>
+	<name>Flink : Architecture Tests : Production</name>
 
 	<packaging>jar</packaging>
 
-	<properties>
-		<archunit.version>0.22.0</archunit.version>
-	</properties>
-
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-architecture-tests-base</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-annotations</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>com.tngtech.archunit</groupId>
 			<artifactId>archunit</artifactId>
-			<version>${archunit.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>com.tngtech.archunit</groupId>
 			<artifactId>archunit-junit5</artifactId>
-			<version>${archunit.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<!-- Tested Flink modules -->
@@ -66,8 +61,6 @@ under the License.
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-core</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<!-- Table API & SQL -->
@@ -75,50 +68,36 @@ under the License.
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-table-common</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-table-api-java</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-table-api-java-bridge</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-table-code-splitter</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-table-runtime</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-sql-client</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<!-- Connectors -->
@@ -126,134 +105,96 @@ under the License.
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-aws-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-cassandra_${scala.binary.version}</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-elasticsearch6</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-elasticsearch7</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-elasticsearch-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-files</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-gcp-pubsub</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-hbase-1.4</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-hbase-2.2</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-hbase-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-hive_${scala.binary.version}</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-jdbc</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-kafka</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-aws-kinesis-data-streams</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-kinesis</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-nifi</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-pulsar</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-connector-rabbitmq</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 	</dependencies>
 
diff --git a/flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/ArchitectureTest.java b/flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/ArchitectureTest.java
new file mode 100644
index 0000000..3eae3e2
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/ArchitectureTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.ApiAnnotationRules;
+import org.apache.flink.architecture.rules.TableApiRules;
+
+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. */
+@AnalyzeClasses(
+        packages = "org.apache.flink",
+        importOptions = {
+            ImportOption.DoNotIncludeTests.class,
+            ImportOptions.ExcludeScalaImportOption.class,
+            ImportOptions.ExcludeShadedImportOption.class
+        })
+public class ArchitectureTest {
+    @ArchTest
+    public static final ArchTests API_ANNOTATIONS = ArchTests.in(ApiAnnotationRules.class);
+
+    @ArchTest public static final ArchTests TABLE_API = ArchTests.in(TableApiRules.class);
+}
diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java b/flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java
similarity index 100%
rename from flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java
rename to flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java
diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/TableApiRules.java b/flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/rules/TableApiRules.java
similarity index 100%
rename from flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/TableApiRules.java
rename to flink-architecture-tests/flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/rules/TableApiRules.java
diff --git a/flink-architecture-tests/flink-architecture-tests-production/src/test/resources/archunit.properties b/flink-architecture-tests/flink-architecture-tests-production/src/test/resources/archunit.properties
new file mode 100644
index 0000000..15be88c
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-production/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-architecture-tests/flink-architecture-tests-production/src/test/resources/log4j2-test.properties b/flink-architecture-tests/flink-architecture-tests-production/src/test/resources/log4j2-test.properties
new file mode 100644
index 0000000..b1c818d
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-production/src/test/resources/log4j2-test.properties
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+# Set root logger level to OFF to not flood build logs
+# set manually to INFO for debugging purposes
+rootLogger.level = OFF
+rootLogger.appenderRef.test.ref = TestLogger
+
+appender.testlogger.name = TestLogger
+appender.testlogger.type = CONSOLE
+appender.testlogger.target = SYSTEM_ERR
+appender.testlogger.layout.type = PatternLayout
+appender.testlogger.layout.pattern = %-4r [%t] %-5p %c %x - %m%n
diff --git a/flink-architecture-tests/flink-architecture-tests-test/pom.xml b/flink-architecture-tests/flink-architecture-tests-test/pom.xml
new file mode 100644
index 0000000..e227322
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-test/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.flink</groupId>
+		<artifactId>flink-architecture-tests</artifactId>
+		<version>1.15-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+
+	<artifactId>flink-architecture-tests-test</artifactId>
+	<name>Flink : Architecture Tests : Test</name>
+
+	<packaging>jar</packaging>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-architecture-tests-base</artifactId>
+			<version>${project.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.tngtech.archunit</groupId>
+			<artifactId>archunit</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>com.tngtech.archunit</groupId>
+			<artifactId>archunit-junit5</artifactId>
+		</dependency>
+
+		<!-- Test Utils -->
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-test-utils</artifactId>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-enforcer-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>dependency-convergence</id>
+						<goals>
+							<goal>enforce</goal>
+						</goals>
+						<configuration>
+							<skip>true</skip>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>
diff --git a/flink-architecture-tests/pom.xml b/flink-architecture-tests/pom.xml
index 5521684..d154a50 100644
--- a/flink-architecture-tests/pom.xml
+++ b/flink-architecture-tests/pom.xml
@@ -16,10 +16,10 @@ software distributed under the License is distributed on an
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
 	<modelVersion>4.0.0</modelVersion>
 
@@ -27,235 +27,241 @@ under the License.
 		<groupId>org.apache.flink</groupId>
 		<artifactId>flink-parent</artifactId>
 		<version>1.15-SNAPSHOT</version>
-		<relativePath>..</relativePath>
+		<relativePath>../pom.xml</relativePath>
 	</parent>
 
 	<artifactId>flink-architecture-tests</artifactId>
 	<name>Flink : Architecture Tests</name>
-
-	<packaging>jar</packaging>
-
-	<properties>
-		<archunit.version>0.22.0</archunit.version>
-	</properties>
-
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-annotations</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>com.tngtech.archunit</groupId>
-			<artifactId>archunit</artifactId>
-			<version>${archunit.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>com.tngtech.archunit</groupId>
-			<artifactId>archunit-junit5</artifactId>
-			<version>${archunit.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<!-- Tested Flink modules -->
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-core</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<!-- Table API & SQL -->
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-table-common</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-table-api-java</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-table-api-java-bridge</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-table-code-splitter</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-table-runtime</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-sql-client</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<!-- Connectors -->
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-aws-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-cassandra_${scala.binary.version}</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-elasticsearch6</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-elasticsearch7</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-elasticsearch-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-files</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-gcp-pubsub</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-hbase-1.4</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-hbase-2.2</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-hbase-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-hive_${scala.binary.version}</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-jdbc</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-kafka</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-aws-kinesis-data-streams</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-kinesis</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-nifi</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-pulsar</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-connector-rabbitmq</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
+	<packaging>pom</packaging>
+
+	<modules>
+		<module>flink-architecture-tests-base</module>
+		<module>flink-architecture-tests-production</module>
+		<module>flink-architecture-tests-test</module>
+	</modules>
+
+	<dependencyManagement>
+
+		<dependencies>
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-architecture-tests-base</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-annotations</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<!-- Tested Flink modules -->
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-core</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<!-- Table API & SQL -->
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-table-common</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-table-api-java</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-table-api-java-bridge</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-table-code-splitter</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-table-runtime</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-sql-client</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<!-- Connectors -->
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-base</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-aws-base</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-cassandra_${scala.binary.version}</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-elasticsearch6</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-elasticsearch7</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-elasticsearch-base</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-files</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-gcp-pubsub</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-hbase-1.4</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-hbase-2.2</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-hbase-base</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-hive_${scala.binary.version}</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-jdbc</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-kafka</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-aws-kinesis-data-streams</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-kinesis</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-nifi</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-pulsar</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-connector-rabbitmq</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<!-- Test Utils -->
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-test-utils</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
 
 	<build>
 		<plugins>
diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Predicates.java b/flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Predicates.java
deleted file mode 100644
index 1cdcc21..0000000
--- a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Predicates.java
+++ /dev/null
@@ -1,54 +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.flink.architecture.common;
-
-import com.tngtech.archunit.base.DescribedPredicate;
-import com.tngtech.archunit.core.domain.JavaClass;
-import com.tngtech.archunit.core.domain.JavaField;
-import com.tngtech.archunit.core.domain.JavaModifier;
-import com.tngtech.archunit.core.domain.properties.CanBeAnnotated;
-
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-
-/** Common predicates for architecture tests. */
-public class Predicates {
-
-    @SafeVarargs
-    public static DescribedPredicate<JavaClass> areDirectlyAnnotatedWithAtLeastOneOf(
-            Class<? extends Annotation>... annotations) {
-        return Arrays.stream(annotations)
-                .map(CanBeAnnotated.Predicates::annotatedWith)
-                .reduce(DescribedPredicate::or)
-                .orElseThrow(IllegalArgumentException::new)
-                .forSubtype();
-    }
-
-    /** Tests that the given field is {@code public static} and of the given type. */
-    public static DescribedPredicate<JavaField> arePublicStaticOfType(Class<?> clazz) {
-        return DescribedPredicate.describe(
-                "are public, static, and of type " + clazz.getSimpleName(),
-                field ->
-                        field.getModifiers().contains(JavaModifier.PUBLIC)
-                                && field.getModifiers().contains(JavaModifier.STATIC)
-                                && field.getRawType().isEquivalentTo(clazz));
-    }
-
-    private Predicates() {}
-}

[flink] 03/06: [FLINK-25220][test] develop ArchUnit rules and test base for ITCase

Posted by ai...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d7c0753afb747099cfa2e1cec53a38b14504b2ee
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Thu Jan 20 11:01:36 2022 +0100

    [FLINK-25220][test] develop ArchUnit rules and test base for ITCase
---
 .../flink-architecture-tests-test/pom.xml          | 23 +++++-
 .../architecture/TestCodeArchitectureTestBase.java | 36 +++++++++
 .../flink/architecture/rules/ITCaseRules.java      | 91 ++++++++++++++++++++++
 .../src/test/resources/archunit.properties         |  5 +-
 .../src/test/resources/log4j2-test.properties}     | 18 ++---
 5 files changed, 161 insertions(+), 12 deletions(-)

diff --git a/flink-architecture-tests/flink-architecture-tests-test/pom.xml b/flink-architecture-tests/flink-architecture-tests-test/pom.xml
index e227322..a5e41ef 100644
--- a/flink-architecture-tests/flink-architecture-tests-test/pom.xml
+++ b/flink-architecture-tests/flink-architecture-tests-test/pom.xml
@@ -39,18 +39,31 @@ under the License.
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-architecture-tests-base</artifactId>
-			<version>${project.version}</version>
-			<scope>test</scope>
+			<scope>compile</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>com.tngtech.archunit</groupId>
 			<artifactId>archunit</artifactId>
+			<scope>compile</scope>
 		</dependency>
 
 		<dependency>
 			<groupId>com.tngtech.archunit</groupId>
 			<artifactId>archunit-junit5</artifactId>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.junit.jupiter</groupId>
+			<artifactId>junit-jupiter</artifactId>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.junit.vintage</groupId>
+			<artifactId>junit-vintage-engine</artifactId>
+			<scope>compile</scope>
 		</dependency>
 
 		<!-- Test Utils -->
@@ -58,6 +71,12 @@ under the License.
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-test-utils</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-test-utils-junit</artifactId>
+			<scope>compile</scope>
 		</dependency>
 	</dependencies>
 
diff --git a/flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/TestCodeArchitectureTestBase.java b/flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/TestCodeArchitectureTestBase.java
new file mode 100644
index 0000000..a33ad9b
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/TestCodeArchitectureTestBase.java
@@ -0,0 +1,36 @@
+/*
+ * 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.rules.ITCaseRules;
+
+import com.tngtech.archunit.junit.ArchTest;
+import com.tngtech.archunit.junit.ArchTests;
+
+/**
+ * Central setup of architectural tests for the test code. This class should be extended for common
+ * tests that are required for all submodules.
+ *
+ * <p>Architectural tests built in submodules should include this class via {@link
+ * ArchTests#in(Class)} to cover the common part.
+ */
+public class TestCodeArchitectureTestBase {
+
+    @ArchTest public static final ArchTests ITCASE = ArchTests.in(ITCaseRules.class);
+}
diff --git a/flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/rules/ITCaseRules.java b/flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/rules/ITCaseRules.java
new file mode 100644
index 0000000..01ec704
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-test/src/main/java/org/apache/flink/architecture/rules/ITCaseRules.java
@@ -0,0 +1,91 @@
+/*
+ * 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.rules;
+
+import org.apache.flink.core.testutils.AllCallbackWrapper;
+import org.apache.flink.runtime.testutils.MiniClusterExtension;
+import org.apache.flink.test.util.AbstractTestBase;
+import org.apache.flink.test.util.MiniClusterWithClientResource;
+
+import com.tngtech.archunit.junit.ArchTest;
+import com.tngtech.archunit.lang.ArchRule;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import static com.tngtech.archunit.core.domain.JavaModifier.ABSTRACT;
+import static com.tngtech.archunit.library.freeze.FreezingArchRule.freeze;
+import static org.apache.flink.architecture.common.Conditions.fulfill;
+import static org.apache.flink.architecture.common.GivenJavaClasses.javaClassesThat;
+import static org.apache.flink.architecture.common.Predicates.arePublicFinalOfTypeWithAnnotation;
+import static org.apache.flink.architecture.common.Predicates.arePublicStaticFinalOfType;
+import static org.apache.flink.architecture.common.Predicates.arePublicStaticFinalOfTypeWithAnnotation;
+import static org.apache.flink.architecture.common.Predicates.containAnyFieldsInClassHierarchyThat;
+
+/** Rules for Integration Tests. */
+public class ITCaseRules {
+
+    @ArchTest
+    public static final ArchRule INTEGRATION_TEST_ENDING_WITH_ITCASE =
+            freeze(
+                    javaClassesThat()
+                            .areAssignableTo(AbstractTestBase.class)
+                            .and()
+                            .doNotHaveModifier(ABSTRACT)
+                            .should()
+                            .haveSimpleNameEndingWith("ITCase"));
+
+    @ArchTest
+    public static final ArchRule ITCASE_USE_MINICLUSTER =
+            freeze(
+                    javaClassesThat()
+                            .haveSimpleNameEndingWith("ITCase")
+                            .and()
+                            .areTopLevelClasses()
+                            .and()
+                            .doNotHaveModifier(ABSTRACT)
+                            .should(
+                                    fulfill(
+                                            // JUnit 5 violation check
+                                            containAnyFieldsInClassHierarchyThat(
+                                                            arePublicStaticFinalOfType(
+                                                                    MiniClusterExtension.class))
+                                                    .and(
+                                                            containAnyFieldsInClassHierarchyThat(
+                                                                    arePublicStaticFinalOfTypeWithAnnotation(
+                                                                            AllCallbackWrapper
+                                                                                    .class,
+                                                                            RegisterExtension
+                                                                                    .class)))
+                                                    // JUnit 4 violation check, which should be
+                                                    // removed
+                                                    // after the JUnit 4->5 migration is closed.
+                                                    .or(
+                                                            containAnyFieldsInClassHierarchyThat(
+                                                                    arePublicStaticFinalOfTypeWithAnnotation(
+                                                                            MiniClusterWithClientResource
+                                                                                    .class,
+                                                                            ClassRule.class)))
+                                                    .or(
+                                                            containAnyFieldsInClassHierarchyThat(
+                                                                    arePublicFinalOfTypeWithAnnotation(
+                                                                            MiniClusterWithClientResource
+                                                                                    .class,
+                                                                            Rule.class))))));
+}
diff --git a/flink-architecture-tests/src/test/resources/archunit.properties b/flink-architecture-tests/flink-architecture-tests-test/src/test/resources/archunit.properties
similarity index 85%
copy from flink-architecture-tests/src/test/resources/archunit.properties
copy to flink-architecture-tests/flink-architecture-tests-test/src/test/resources/archunit.properties
index df5890a..15be88c 100644
--- a/flink-architecture-tests/src/test/resources/archunit.properties
+++ b/flink-architecture-tests/flink-architecture-tests-test/src/test/resources/archunit.properties
@@ -19,10 +19,13 @@
 # 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=violations
+freeze.store.default.path=archunit-violations
diff --git a/flink-architecture-tests/src/test/resources/archunit.properties b/flink-architecture-tests/flink-architecture-tests-test/src/test/resources/log4j2-test.properties
similarity index 59%
rename from flink-architecture-tests/src/test/resources/archunit.properties
rename to flink-architecture-tests/flink-architecture-tests-test/src/test/resources/log4j2-test.properties
index df5890a..b1c818d 100644
--- a/flink-architecture-tests/src/test/resources/archunit.properties
+++ b/flink-architecture-tests/flink-architecture-tests-test/src/test/resources/log4j2-test.properties
@@ -16,13 +16,13 @@
 # limitations under the License.
 #
 
-# By default we allow removing existing violations, but fail when new violations are added.
-freeze.store.default.allowStoreUpdate=true
+# Set root logger level to OFF to not flood build logs
+# set manually to INFO for debugging purposes
+rootLogger.level = OFF
+rootLogger.appenderRef.test.ref = TestLogger
 
-# 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=violations
+appender.testlogger.name = TestLogger
+appender.testlogger.type = CONSOLE
+appender.testlogger.target = SYSTEM_ERR
+appender.testlogger.layout.type = PatternLayout
+appender.testlogger.layout.pattern = %-4r [%t] %-5p %c %x - %m%n

[flink] 04/06: [FLINK-25220][test] ITCase ArchUnit test for HBase-2.2 connector

Posted by ai...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8a0b1c034b3f540666874bf6a0dfa5dc8b4f26aa
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Thu Jan 20 21:14:53 2022 +0100

    [FLINK-25220][test] ITCase ArchUnit test for HBase-2.2 connector
---
 .../3688e857-50b4-4310-b42c-4280c66dc351           |  0
 .../bed6cd0b-4684-4af5-ae26-8400fd99c2dd           |  0
 .../archunit-violations/stored.rules               |  4 +++
 flink-connectors/flink-connector-hbase-2.2/pom.xml |  9 +++++
 .../architecture/TestCodeArchitectureTest.java     | 40 ++++++++++++++++++++++
 .../src/test/resources/archunit.properties         | 31 +++++++++++++++++
 6 files changed, 84 insertions(+)

diff --git a/flink-connectors/flink-connector-hbase-2.2/archunit-violations/3688e857-50b4-4310-b42c-4280c66dc351 b/flink-connectors/flink-connector-hbase-2.2/archunit-violations/3688e857-50b4-4310-b42c-4280c66dc351
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connectors/flink-connector-hbase-2.2/archunit-violations/bed6cd0b-4684-4af5-ae26-8400fd99c2dd b/flink-connectors/flink-connector-hbase-2.2/archunit-violations/bed6cd0b-4684-4af5-ae26-8400fd99c2dd
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connectors/flink-connector-hbase-2.2/archunit-violations/stored.rules b/flink-connectors/flink-connector-hbase-2.2/archunit-violations/stored.rules
new file mode 100644
index 0000000..5b0c12c
--- /dev/null
+++ b/flink-connectors/flink-connector-hbase-2.2/archunit-violations/stored.rules
@@ -0,0 +1,4 @@
+#
+#Thu Jan 20 18:36:56 CET 2022
+classes\ that\ are\ Java\ classes\ and\ have\ simple\ name\ ending\ with\ 'ITCase'\ and\ are\ top\ level\ classes\ and\ do\ not\ have\ modifier\ ABSTRACT\ should\ contain\ any\ fields\ that\ are\ public,\ static,\ and\ of\ type\ MiniClusterExtension\ and\ final\ and\ contain\ any\ fields\ that\ are\ public,\ static,\ and\ of\ type\ AllCallbackWrapper\ and\ final\ and\ annotated\ with\ @RegisterExtension\ or\ contain\ any\ fields\ that\ are\ public,\ static,\ and\ of\ type\ MiniClusterWit [...]
+classes\ that\ are\ Java\ classes\ and\ are\ assignable\ to\ org.apache.flink.test.util.AbstractTestBase\ and\ do\ not\ have\ modifier\ ABSTRACT\ should\ have\ simple\ name\ ending\ with\ 'ITCase'=3688e857-50b4-4310-b42c-4280c66dc351
diff --git a/flink-connectors/flink-connector-hbase-2.2/pom.xml b/flink-connectors/flink-connector-hbase-2.2/pom.xml
index 841f313..46ef519 100644
--- a/flink-connectors/flink-connector-hbase-2.2/pom.xml
+++ b/flink-connectors/flink-connector-hbase-2.2/pom.xml
@@ -413,6 +413,15 @@ under the License.
 				</exclusion>
 			</exclusions>
 		</dependency>
+
+		<!-- ArchUit test dependencies -->
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-architecture-tests-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+
 	</dependencies>
 
 	<profiles>
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
new file mode 100644
index 0000000..3584360
--- /dev/null
+++ b/flink-connectors/flink-connector-hbase-2.2/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 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.hbase2",
+        importOptions = {
+            ImportOption.OnlyIncludeTests.class,
+            ImportOptions.ExcludeScalaImportOption.class,
+            ImportOptions.ExcludeShadedImportOption.class
+        })
+public class TestCodeArchitectureTest {
+
+    @ArchTest
+    public static final ArchTests COMMON_TESTS = ArchTests.in(TestCodeArchitectureTestBase.class);
+}
diff --git a/flink-connectors/flink-connector-hbase-2.2/src/test/resources/archunit.properties b/flink-connectors/flink-connector-hbase-2.2/src/test/resources/archunit.properties
new file mode 100644
index 0000000..15be88c
--- /dev/null
+++ b/flink-connectors/flink-connector-hbase-2.2/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

[flink] 01/06: [FLINK-25220][test] update flink pom for ArchUnit test infra

Posted by ai...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c132595205130622352821bb95c77399d54ba2e0
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Thu Jan 20 21:08:49 2022 +0100

    [FLINK-25220][test] update flink pom for ArchUnit test infra
    
    - define some ArchUnit dependencies in the dependencyManagement
    - exclude archunit-violations stores from the license check
---
 pom.xml | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index f41649d..44eef02 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,6 +129,7 @@ under the License.
 		<jaxb.api.version>2.3.1</jaxb.api.version>
 		<junit4.version>4.13.2</junit4.version>
 		<junit5.version>5.8.1</junit5.version>
+		<archunit.version>0.22.0</archunit.version>
 		<mockito.version>2.21.0</mockito.version>
 		<powermock.version>2.0.9</powermock.version>
 		<hamcrest.version>1.3</hamcrest.version>
@@ -784,6 +785,21 @@ under the License.
 				<scope>test</scope>
 			</dependency>
 
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-architecture-tests-base</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.flink</groupId>
+				<artifactId>flink-architecture-tests-test</artifactId>
+				<version>${project.version}</version>
+				<scope>test</scope>
+			</dependency>
+
 			<dependency>
 				<!-- log4j2 has an optional dependency on disruptor which may affect other dependencies (like hive)
 					pin the version here to make this behavior explicit -->
@@ -811,6 +827,21 @@ under the License.
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
+
+			<dependency>
+				<groupId>com.tngtech.archunit</groupId>
+				<artifactId>archunit</artifactId>
+				<version>${archunit.version}</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>com.tngtech.archunit</groupId>
+				<artifactId>archunit-junit5</artifactId>
+				<version>${archunit.version}</version>
+				<scope>test</scope>
+			</dependency>
+
 		</dependencies>
 	</dependencyManagement>
 
@@ -1456,7 +1487,9 @@ under the License.
 						<exclude>flink-connectors/flink-connector-aws-kinesis-data-streams/src/test/resources/profile</exclude>
 						<exclude>flink-table/flink-table-code-splitter/src/test/resources/**</exclude>
 						<exclude>flink-connectors/flink-connector-pulsar/src/test/resources/**</exclude>
-						<exclude>flink-architecture-tests/violations/**</exclude>
+
+						<!-- ArchUnit violation stores  -->
+						<exclude>**/archunit-violations/**</exclude>
 
 						<!-- snapshots -->
 						<exclude>**/src/test/resources/serializer-snapshot-*</exclude>

[flink] 06/06: [FLINK-25220][test] update README.md

Posted by ai...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4f6240848ed8b2cb2548239b49b7bcb392ee909e
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Mon Jan 24 17:18:43 2022 +0100

    [FLINK-25220][test] update README.md
---
 flink-architecture-tests/README.md                 | 48 +++++++++++-------
 .../flink-architecture-tests-production/README.md  | 33 +++++++++++++
 .../flink-architecture-tests-test/README.md        | 57 ++++++++++++++++++++++
 3 files changed, 121 insertions(+), 17 deletions(-)

diff --git a/flink-architecture-tests/README.md b/flink-architecture-tests/README.md
index 11b2b64..d83292f 100644
--- a/flink-architecture-tests/README.md
+++ b/flink-architecture-tests/README.md
@@ -1,13 +1,30 @@
 # flink-architecture-tests
 
-This module contains architecture tests using [ArchUnit](https://www.archunit.org/). These tests 
-reside in their own module in order to control the classpath of which modules should be tested.
-Running these tests together (rather than individually per module) allows caching the imported
-classes for better performance.
+This module contains architecture tests using [ArchUnit](https://www.archunit.org/). Considering the
+isolation of classpath and rules for architectural tests, there are two top level categories:
+
+- production code architectural tests
+- test code architectural tests
+
+Since both of them will need some common ArchUnit extensions, there are three submodules:
+
+- flink-architecture-tests-base - contains common ArchUnit extensions that will be used for both
+  production code architectural tests and test code architectural tests.
+- flink-architecture-tests-production - contains all architectural rules and tests centrally for
+  production code. Please read the [README](flink-architecture-tests-production/README.md) of
+  flink-architecture-tests-production for further information.
+- flink-architecture-tests - contains architectural rules centrally for test code. The architectural
+  test will be built individually in each submodule where the test code has been developed. Please
+  read the [README](flink-architecture-tests-test/README.md) of flink-architecture-tests-test for
+  further information.
+
+Following documentation is valid for building and maintaining the architectural tests both for the
+production code and the test code.
 
 ## What should I do if the tests fail?
 
-There are two cases in which the architectural tests may fail due to changes in the codebase:
+There are two cases in which architectural tests may fail due to changes in the codebase:
+
 1. You have resolved an existing violation.
 2. Your change introduced a new violation.
 
@@ -15,29 +32,26 @@ In the former case, please add the updated violation store file to your commit.
 succeed.
 
 If you have added a new violation, consider how to proceed. New violations should be avoided at all
-costs. First and foremost, evaluate whether the flagged violation is correct. If it is, try to rework
-your change to avoid the violation in the first place. However, if you believe that your code should
-not be flagged as a violation, open a JIRA issue so that the rule can be improved.
+costs. First and foremost, evaluate whether the flagged violation is correct. If it is, try to
+rework your change to avoid the violation in the first place. However, if you believe that your code
+should not be flagged as a violation, open a JIRA issue so that the rule can be improved.
 
-In order to have a new violation recorded, open `archunit.properties` and enable
+In order to have a new violation recorded, open `archunit.properties` in the submodule and enable
 `freeze.refreeze=true`. Rerun the tests and revert the change to the configuration. The new
 violation should now have been added to the existing store.
 
-## How do I add a module?
-
-In order to add a module to be tested against, add it as a test dependency in this module's 
-`pom.xml`.
-
 ## How do I write a new architectural rule?
 
 Please refer to the [ArchUnit user guide](https://www.archunit.org/) for general documentation.
 However, there are a few points to consider when writing rules:
 
 1. If there are existing violations which cannot be fixed right away, the rule must be _frozen_ by
-   wrapping it in `FreezingArchRule.freeze()`. This will add the rule to the violation store that 
-   records the existing violations. Add the new stored violations file within `violations` to your 
+   wrapping it in `FreezingArchRule.freeze()`. This will add the rule to the violation store that
+   records the existing violations. Add the new stored violations file within `violations` to your
    commit.
-2. ArchUnit does not work well with Scala classes. All rules should exclude non-Java classes by
+2. In order to allow creating new violation store file, open `archunit.properties` in the submodule
+   and enable `freeze.store.default.allowStoreCreation=true`.
+3. ArchUnit does not work well with Scala classes. All rules should exclude non-Java classes by
    utilizing the methods in `GivenJavaClasses`.
 
 ## How do I test Scala classes?
diff --git a/flink-architecture-tests/flink-architecture-tests-production/README.md b/flink-architecture-tests/flink-architecture-tests-production/README.md
new file mode 100644
index 0000000..c6ab91d
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-production/README.md
@@ -0,0 +1,33 @@
+# flink-architecture-tests-production
+
+This submodule contains all architectural tests of production code. 
+Running these tests together (rather than individually per module) allows caching the imported
+classes for better performance.
+
+## What should I do if the tests fail?
+
+Please refer to [README](../README.md).
+
+## How do I write a new architectural rule?
+
+Please refer to [README](../README.md).
+
+## How do I write a ArchUnit test?
+
+Please refer to the [ArchUnit user guide](https://www.archunit.org/) for general documentation. For
+quick start, you could find an example
+at [flink-architecture-tests-production/ArchitectureTest](./flink-architecture-tests-production/src/test/java/org/apache/flink/architecture/ArchitectureTest.java):
+
+```java
+@ArchTest
+public static final ArchTests API_ANNOTATIONS=ArchTests.in(ApiAnnotationRules.class);
+```
+
+## How do I add a module?
+
+In order to add a module to be tested against, add it as a test dependency in this module's
+`pom.xml`.
+
+## How do I test Scala classes?
+
+Please refer to [README](../README.md).
diff --git a/flink-architecture-tests/flink-architecture-tests-test/README.md b/flink-architecture-tests/flink-architecture-tests-test/README.md
new file mode 100644
index 0000000..af687e3
--- /dev/null
+++ b/flink-architecture-tests/flink-architecture-tests-test/README.md
@@ -0,0 +1,57 @@
+# flink-architecture-tests-test
+
+This submodule contains rules defined centrally for test code architectural tests that will be
+developed in each submodule individually where the test code has been developed.
+
+## Why the architecture test infra for production code and for test code are different
+
+Compared to `flink-architecture-tests-production` which implements and executes architectural rules
+centrally, `flink-architecture-tests-test` implements the rules centrally, but they are executed
+individually in each submodule. This is done for the following reasons:
+
+- Reduce the classpath complexity. In order to execute the tests centrally, each submodule would
+  have to provide a test-jar. However, this does not work well in IntelliJ which doesn't support all
+  Maven configurations (such as exclusion filters); this would cause the rules to behave differently
+  when executed from Maven versus IntelliJ. Furthermore, creating more test-jars is not desirable
+  and increases the project complexity.
+- Separation of concerns. Test code should be viewed as internal to a module, and by separating the
+  violation stores for each submodule this separation can be maintained. Unlike the production code
+  tests there is few shared code between test code, and thus the performance benefits do not apply.
+- Flexibility. Each submodule can not only import the generic rules defined
+  in `flink-architecture-tests-test` centrally, but also develop further module-specific
+  architectural tests locally.
+
+## How do I write a new architectural rule?
+
+Please refer to [README](../README.md).
+
+## How do I initialize and develop the first architectural test for a Flink submodule's test code?
+
+If there already exists any architectural test in the Flink submodule, you can skip this section and
+start writing your architectural tests and rules.
+
+It is recommended to stick to the following template to setup and develop the first test code
+architectural test for a Flink submodule.
+
+Under a Flink submodule where no architectural test has ever been developed.
+
+- Create `archunit.properties` and `flink-connector-file` under "<Flink Submodule>
+  /src/test/resources". Please use [archunit.properties](./src/test/resources/archunit.properties)
+  and [log4j2-test.properties](./src/test/resources/log4j2-test.properties) as template.
+- Develop ArchUnit test under the package `org.apache.flink.architecture`. It is recommended to
+  use `TestCodeArchitectureTest` as the class name.
+- Include the common tests
+  via `@ArchTest public static final ArchTests COMMON_TESTS = ArchTests.in(TestCodeArchitectureTestBase.class)`
+  .
+- Develop individual rules under the package `org.apache.flink.architecture.rules` if it is
+  required.
+
+For practice purpose, please refer to the `flink-connector-file` as the reference implementation.
+
+## What should I do if the tests fail?
+
+Please refer to [README](../README.md).
+
+## How do I test Scala classes?
+
+Please refer to [README](../README.md).