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:10 UTC
[flink] 02/06: [FLINK-25220][test] Split architecture-tests and build ArchUnit extension
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() {}
-}