Skip to content

Commit

Permalink
[FLINK-33637][table-planner][JUnit5 Migration] Introduce ArchTest to …
Browse files Browse the repository at this point in the history
…ban Junit 4 for module table-planner
  • Loading branch information
Jiabao-Sun committed Nov 24, 2023
1 parent 177966d commit 1c8e016
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
#Fri Nov 24 17:08:17 CST 2023
Junit4\ is\ forbidden,\ please\ use\ Junit5\ instead=a17c9d3e-9546-4787-a16e-91f74fc9a335
8 changes: 8 additions & 0 deletions flink-table/flink-table-planner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ under the License.
<scope>test</scope>
</dependency>

<!-- ArchUit test dependencies -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-architecture-tests-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<!-- Table API Scala dependencies -->

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.apache.flink.architecture;

import org.apache.flink.architecture.common.ImportOptions;
import org.apache.flink.architecture.rules.BanJunit4Rules;

import com.tngtech.archunit.core.importer.ImportOption;
import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.junit.ArchTests;

/** Architecture tests for test code. */
@AnalyzeClasses(
packages = {
"org.apache.flink.connector.file.table",
"org.apache.flink.formats.testcsv",
"org.apache.flink.table.api",
"org.apache.flink.table.planner",
"org.apache.flink.table.test",
},
importOptions = {
ImportOption.OnlyIncludeTests.class,
ImportOptions.ExcludeScalaImportOption.class,
ImportOptions.ExcludeShadedImportOption.class
})
public class TestCodeArchitectureTest {

@ArchTest public static final ArchTests BAN_JUNIT4_TESTS = ArchTests.in(BanJunit4Rules.class);
}
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1c8e016

Please sign in to comment.