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

[flink-connector-elasticsearch] 06/06: [FLINK-27061][ES-base] ArchUnit test for production code

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

martijnvisser pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-connector-elasticsearch.git

commit f966128604c565b68bd16de9b74d008b7061848d
Author: Jing Ge <ge...@gmail.com>
AuthorDate: Wed Apr 6 17:19:25 2022 +0200

    [FLINK-27061][ES-base] ArchUnit test for production code
---
 .../06cb39ec-97e2-4e4e-8aa7-cd92504b759c           |  0
 .../09532d6b-7cb1-4621-90af-755558763875           |  0
 .../143fca50-a3b9-4a4b-983e-40dd2c424f62           |  0
 .../4539e81b-9c72-4fd7-b7b3-ffc2e546b968           |  0
 .../aca99410-c331-4bc2-a45b-1363eb8dd20c           |  0
 .../archunit-violations/stored.rules               |  7 ++-
 .../ProductionCodeArchitectureTest.java            | 54 ++++++++++++++++++++++
 7 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/flink-connector-elasticsearch-base/archunit-violations/06cb39ec-97e2-4e4e-8aa7-cd92504b759c b/flink-connector-elasticsearch-base/archunit-violations/06cb39ec-97e2-4e4e-8aa7-cd92504b759c
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connector-elasticsearch-base/archunit-violations/09532d6b-7cb1-4621-90af-755558763875 b/flink-connector-elasticsearch-base/archunit-violations/09532d6b-7cb1-4621-90af-755558763875
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connector-elasticsearch-base/archunit-violations/143fca50-a3b9-4a4b-983e-40dd2c424f62 b/flink-connector-elasticsearch-base/archunit-violations/143fca50-a3b9-4a4b-983e-40dd2c424f62
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connector-elasticsearch-base/archunit-violations/4539e81b-9c72-4fd7-b7b3-ffc2e546b968 b/flink-connector-elasticsearch-base/archunit-violations/4539e81b-9c72-4fd7-b7b3-ffc2e546b968
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connector-elasticsearch-base/archunit-violations/aca99410-c331-4bc2-a45b-1363eb8dd20c b/flink-connector-elasticsearch-base/archunit-violations/aca99410-c331-4bc2-a45b-1363eb8dd20c
new file mode 100644
index 0000000..e69de29
diff --git a/flink-connector-elasticsearch-base/archunit-violations/stored.rules b/flink-connector-elasticsearch-base/archunit-violations/stored.rules
index 76f9416..7560973 100644
--- a/flink-connector-elasticsearch-base/archunit-violations/stored.rules
+++ b/flink-connector-elasticsearch-base/archunit-violations/stored.rules
@@ -1,4 +1,9 @@
 #
-#Tue Feb 22 12:16:59 CET 2022
+#Wed Apr 06 17:09:41 CEST 2022
+Options\ for\ connectors\ and\ formats\ should\ reside\ in\ a\ consistent\ package\ and\ be\ public\ API.=aca99410-c331-4bc2-a45b-1363eb8dd20c
+Production\ code\ must\ not\ call\ methods\ annotated\ with\ @VisibleForTesting=4539e81b-9c72-4fd7-b7b3-ffc2e546b968
 Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=de342dd1-c974-42c9-8f64-ef182ba8c56d
+Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @PublicEvolving\ must\ be\ annotated\ with\ @Public(Evolving).=09532d6b-7cb1-4621-90af-755558763875
+Classes\ in\ API\ packages\ should\ have\ at\ least\ one\ API\ visibility\ annotation.=143fca50-a3b9-4a4b-983e-40dd2c424f62
 ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=dd583797-83e1-414c-a38d-330773978813
+Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @Public\ must\ be\ annotated\ with\ @Public.=06cb39ec-97e2-4e4e-8aa7-cd92504b759c
diff --git a/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/architecture/ProductionCodeArchitectureTest.java b/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/architecture/ProductionCodeArchitectureTest.java
new file mode 100644
index 0000000..90edf6f
--- /dev/null
+++ b/flink-connector-elasticsearch-base/src/test/java/org/apache/flink/architecture/ProductionCodeArchitectureTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.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;
+
+/** product code Architecture tests. */
+@AnalyzeClasses(
+        packages = "org.apache.flink.connector",
+        importOptions = {
+            ImportOption.DoNotIncludeTests.class,
+            ImportOption.DoNotIncludeArchives.class,
+            ImportOptions.ExcludeScalaImportOption.class,
+            ImportOptions.ExcludeShadedImportOption.class
+        })
+public class ProductionCodeArchitectureTest {
+
+    @ArchTest
+    public static final ArchTests COMMON_TESTS = ArchTests.in(ProductionCodeArchitectureBase.class);
+
+    /** test. */
+    public static final class MavenMainClassesOnly implements ImportOption {
+        private static final Pattern MAVEN = Pattern.compile(".*/target/classes/.*");
+
+        @Override
+        public boolean includes(Location location) {
+            return location.matches(MAVEN);
+        }
+    }
+}