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 <[email protected]> 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
