This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new fc9d8804b87 Flag junit tests missing production classes (#37505)
fc9d8804b87 is described below
commit fc9d8804b87d59ac2b2323ef8aa784b5af459a67
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Dec 25 13:59:10 2025 +0800
Flag junit tests missing production classes (#37505)
---
...ava => TypedPropertiesServerExceptionTest.java} | 2 +-
...ava => AbsolutePathLocalFileURLLoaderTest.java} | 2 +-
...t.java => ClassPathLocalFileURLLoaderTest.java} | 2 +-
.../table/DataMatchTableInventoryCheckerTest.java | 67 ----------------------
.../parser/rdl/RegisterStorageUnitTest.java | 50 ----------------
.../ColumnExtractorParameterizedTest.java | 60 -------------------
.../core/extractor/ColumnExtractorTest.java | 30 ++++++++++
7 files changed, 33 insertions(+), 180 deletions(-)
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/props/exception/TypedPropertiesExceptionTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/props/exception/TypedPropertiesServerExceptionTest.java
similarity index 96%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/props/exception/TypedPropertiesExceptionTest.java
rename to
infra/common/src/test/java/org/apache/shardingsphere/infra/props/exception/TypedPropertiesServerExceptionTest.java
index 5e0b898e4a3..7197778c6f4 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/props/exception/TypedPropertiesExceptionTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/props/exception/TypedPropertiesServerExceptionTest.java
@@ -24,7 +24,7 @@ import java.util.Arrays;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-class TypedPropertiesExceptionTest {
+class TypedPropertiesServerExceptionTest {
@Test
void assertGetMessage() {
diff --git
a/infra/url/type/absolutepath/src/test/java/org/apache/shardingsphere/infra/url/absolutepath/AbsolutePathURLLoaderTest.java
b/infra/url/type/absolutepath/src/test/java/org/apache/shardingsphere/infra/url/absolutepath/AbsolutePathLocalFileURLLoaderTest.java
similarity index 97%
rename from
infra/url/type/absolutepath/src/test/java/org/apache/shardingsphere/infra/url/absolutepath/AbsolutePathURLLoaderTest.java
rename to
infra/url/type/absolutepath/src/test/java/org/apache/shardingsphere/infra/url/absolutepath/AbsolutePathLocalFileURLLoaderTest.java
index bb0245bdefb..eb9fe078cdf 100644
---
a/infra/url/type/absolutepath/src/test/java/org/apache/shardingsphere/infra/url/absolutepath/AbsolutePathURLLoaderTest.java
+++
b/infra/url/type/absolutepath/src/test/java/org/apache/shardingsphere/infra/url/absolutepath/AbsolutePathLocalFileURLLoaderTest.java
@@ -27,7 +27,7 @@ import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-class AbsolutePathURLLoaderTest {
+class AbsolutePathLocalFileURLLoaderTest {
@Test
@EnabledOnOs({OS.LINUX, OS.MAC})
diff --git
a/infra/url/type/classpath/src/test/java/org/apache/shardingsphere/infra/url/classpath/ClassPathURLLoaderTest.java
b/infra/url/type/classpath/src/test/java/org/apache/shardingsphere/infra/url/classpath/ClassPathLocalFileURLLoaderTest.java
similarity index 97%
rename from
infra/url/type/classpath/src/test/java/org/apache/shardingsphere/infra/url/classpath/ClassPathURLLoaderTest.java
rename to
infra/url/type/classpath/src/test/java/org/apache/shardingsphere/infra/url/classpath/ClassPathLocalFileURLLoaderTest.java
index 79fe7981b26..da6c50815d3 100644
---
a/infra/url/type/classpath/src/test/java/org/apache/shardingsphere/infra/url/classpath/ClassPathURLLoaderTest.java
+++
b/infra/url/type/classpath/src/test/java/org/apache/shardingsphere/infra/url/classpath/ClassPathLocalFileURLLoaderTest.java
@@ -26,7 +26,7 @@ import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-class ClassPathURLLoaderTest {
+class ClassPathLocalFileURLLoaderTest {
@Test
@EnabledOnOs({OS.LINUX, OS.MAC})
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableInventoryCheckerTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableInventoryCheckerTest.java
deleted file mode 100644
index 4be11edd9ec..00000000000
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableInventoryCheckerTest.java
+++ /dev/null
@@ -1,67 +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.shardingsphere.data.pipeline.core.consistencycheck.table;
-
-import
org.apache.shardingsphere.data.pipeline.core.consistencycheck.result.TableDataConsistencyCheckIgnoredType;
-import
org.apache.shardingsphere.data.pipeline.core.consistencycheck.result.TableDataConsistencyCheckResult;
-import
org.apache.shardingsphere.data.pipeline.core.metadata.model.PipelineColumnMetaData;
-import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedTable;
-import org.junit.jupiter.api.Test;
-
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class DataMatchTableInventoryCheckerTest {
-
- @Test
- void assertPreCheckWithUniqueKey() {
- try (DataMatchTableDataConsistencyChecker checker = new
DataMatchTableDataConsistencyChecker()) {
- List<PipelineColumnMetaData> uniqueKeys =
Collections.singletonList(new PipelineColumnMetaData(1, "order_id",
Types.INTEGER, "int", false, true, true));
- TableInventoryCheckParameter param =
buildTableInventoryCheckParameter(uniqueKeys);
- TableInventoryChecker tableInventoryChecker =
checker.buildTableInventoryChecker(param);
- Optional<TableDataConsistencyCheckResult> actual =
tableInventoryChecker.preCheck();
- assertFalse(actual.isPresent());
- }
- }
-
- @Test
- void assertPreCheckWithoutUniqueKey() {
- try (DataMatchTableDataConsistencyChecker checker = new
DataMatchTableDataConsistencyChecker()) {
- TableInventoryCheckParameter param =
buildTableInventoryCheckParameter(Collections.emptyList());
- TableInventoryChecker tableInventoryChecker =
checker.buildTableInventoryChecker(param);
- Optional<TableDataConsistencyCheckResult> actual =
tableInventoryChecker.preCheck();
- assertTrue(actual.isPresent());
- assertNotNull(actual.get().getIgnoredType());
- assertThat(actual.get().getIgnoredType(),
is(TableDataConsistencyCheckIgnoredType.NO_UNIQUE_KEY));
- }
- }
-
- private TableInventoryCheckParameter
buildTableInventoryCheckParameter(final List<PipelineColumnMetaData>
uniqueKeys) {
- return new TableInventoryCheckParameter("jobId1", null, null, new
QualifiedTable(null, "t_order"), new QualifiedTable(null, "t_order"),
- Arrays.asList("order_id", "user_id", "status"), uniqueKeys,
null, null);
- }
-}
diff --git
a/parser/distsql/engine/src/test/java/org/apache/shardingsphere/distsql/parser/rdl/RegisterStorageUnitTest.java
b/parser/distsql/engine/src/test/java/org/apache/shardingsphere/distsql/parser/rdl/RegisterStorageUnitTest.java
deleted file mode 100644
index 7838338ecef..00000000000
---
a/parser/distsql/engine/src/test/java/org/apache/shardingsphere/distsql/parser/rdl/RegisterStorageUnitTest.java
+++ /dev/null
@@ -1,50 +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.shardingsphere.distsql.parser.rdl;
-
-import
org.apache.shardingsphere.distsql.parser.engine.api.DistSQLStatementParserEngine;
-import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
-import
org.apache.shardingsphere.distsql.statement.type.rdl.resource.unit.type.RegisterStorageUnitStatement;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-@ExtendWith(MockitoExtension.class)
-class RegisterStorageUnitTest {
-
- @Test
- void assertRegisterStorageUnitSpecialCharacters() {
- String sql = "REGISTER STORAGE UNIT test_db ("
- + "URL='jdbc:mysql://127.0.0.1:3306/test_db',"
- + "USER='root',PASSWORD='\\'\\\"r\\[oo]t');";
- RegisterStorageUnitStatement distSQLStatement =
getRegisterStorageUnitStatement(sql);
- URLBasedDataSourceSegment sqlSegment = (URLBasedDataSourceSegment)
distSQLStatement.getStorageUnits().iterator().next();
- assertThat(sqlSegment.getUrl(),
is("jdbc:mysql://127.0.0.1:3306/test_db"));
- assertThat(sqlSegment.getName(), is("test_db"));
- assertThat(sqlSegment.getUser(), is("root"));
- assertThat(sqlSegment.getPassword(), is("'\"r\\[oo]t"));
- }
-
- private RegisterStorageUnitStatement getRegisterStorageUnitStatement(final
String sql) {
- DistSQLStatementParserEngine distSQLStatementParserEngine = new
DistSQLStatementParserEngine();
- return (RegisterStorageUnitStatement)
distSQLStatementParserEngine.parse(sql);
- }
-}
diff --git
a/parser/sql/statement/core/src/test/java/org/apache/shardingsphere/sql/parser/statement/core/extractor/ColumnExtractorParameterizedTest.java
b/parser/sql/statement/core/src/test/java/org/apache/shardingsphere/sql/parser/statement/core/extractor/ColumnExtractorParameterizedTest.java
deleted file mode 100644
index 41b3d7f7f6f..00000000000
---
a/parser/sql/statement/core/src/test/java/org/apache/shardingsphere/sql/parser/statement/core/extractor/ColumnExtractorParameterizedTest.java
+++ /dev/null
@@ -1,60 +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.shardingsphere.sql.parser.statement.core.extractor;
-
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BetweenExpression;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
-import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.ArgumentsProvider;
-import org.junit.jupiter.params.provider.ArgumentsSource;
-import org.junit.jupiter.params.support.ParameterDeclarations;
-
-import java.util.Collection;
-import java.util.stream.Stream;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-class ColumnExtractorParameterizedTest {
-
- private static final ColumnSegment COLUMN_SEGMENT = new ColumnSegment(35,
42, new IdentifierValue("order_item_id"));
-
- @ParameterizedTest(name = "{0}")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
- void assertExtract(final ExpressionSegment expression) {
- Collection<ColumnSegment> columnSegments =
ColumnExtractor.extract(expression);
- assertThat(columnSegments.size(), is(1));
- assertThat(columnSegments.iterator().next(), is(COLUMN_SEGMENT));
- }
-
- private static final class TestCaseArgumentsProvider implements
ArgumentsProvider {
-
- @Override
- public Stream<? extends Arguments> provideArguments(final
ParameterDeclarations parameters, final ExtensionContext context) {
- return Stream.of(Arguments.of(new BinaryOperationExpression(0, 0,
COLUMN_SEGMENT, null, null, null)),
- Arguments.of(new InExpression(0, 0, COLUMN_SEGMENT, null,
false)),
- Arguments.of(new BetweenExpression(0, 0, COLUMN_SEGMENT,
null, null, false)));
- }
- }
-}
diff --git
a/parser/sql/statement/core/src/test/java/org/apache/shardingsphere/sql/parser/statement/core/extractor/ColumnExtractorTest.java
b/parser/sql/statement/core/src/test/java/org/apache/shardingsphere/sql/parser/statement/core/extractor/ColumnExtractorTest.java
index 186ed519f11..9d7afecb901 100644
---
a/parser/sql/statement/core/src/test/java/org/apache/shardingsphere/sql/parser/statement/core/extractor/ColumnExtractorTest.java
+++
b/parser/sql/statement/core/src/test/java/org/apache/shardingsphere/sql/parser/statement/core/extractor/ColumnExtractorTest.java
@@ -18,21 +18,33 @@
package org.apache.shardingsphere.sql.parser.statement.core.extractor;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BetweenExpression;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.LiteralExpressionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.ArgumentsProvider;
+import org.junit.jupiter.params.provider.ArgumentsSource;
+import org.junit.jupiter.params.support.ParameterDeclarations;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
class ColumnExtractorTest {
+ private static final ColumnSegment COLUMN_SEGMENT = new ColumnSegment(35,
42, new IdentifierValue("order_item_id"));
+
@Test
void assertExtractColumnSegments() {
Collection<ColumnSegment> columnSegments =
ColumnExtractor.extractColumnSegments(createWhereSegments());
@@ -51,4 +63,22 @@ class ColumnExtractorTest {
new ColumnSegment(30, 32, new IdentifierValue("pwd")), new
LiteralExpressionSegment(40, 45, "123456"), "=", "pwd = '123456'");
return Collections.singleton(new WhereSegment(0, 0, new
BinaryOperationExpression(0, 0, leftExpression, rightExpression, "AND", "name =
'LiLei' AND pwd = '123456'")));
}
+
+ @ParameterizedTest(name = "{0}")
+ @ArgumentsSource(TestCaseArgumentsProvider.class)
+ void assertExtract(final ExpressionSegment expression) {
+ Collection<ColumnSegment> columnSegments =
ColumnExtractor.extract(expression);
+ assertThat(columnSegments.size(), is(1));
+ assertThat(columnSegments.iterator().next(), is(COLUMN_SEGMENT));
+ }
+
+ private static final class TestCaseArgumentsProvider implements
ArgumentsProvider {
+
+ @Override
+ public Stream<? extends Arguments> provideArguments(final
ParameterDeclarations parameters, final ExtensionContext context) {
+ return Stream.of(Arguments.of(new BinaryOperationExpression(0, 0,
COLUMN_SEGMENT, null, null, null)),
+ Arguments.of(new InExpression(0, 0, COLUMN_SEGMENT, null,
false)),
+ Arguments.of(new BetweenExpression(0, 0, COLUMN_SEGMENT,
null, null, false)));
+ }
+ }
}