You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/09/20 04:53:07 UTC

(shardingsphere) branch master updated: Remove duplicate sharding rule configuration test (#39904)

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

terrymanu 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 ae8cde42453 Remove duplicate sharding rule configuration test (#39904)
ae8cde42453 is described below

commit ae8cde42453c4efe49cfa04d8bf02ffb4c317e8e
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Sep 20 12:52:59 2026 +0800

    Remove duplicate sharding rule configuration test (#39904)
---
 .../api/config/ShardingRuleConfigurationTest.java  |  1 +
 .../api/config/ShardingRuleConfigurationTest.java  | 46 ----------------------
 2 files changed, 1 insertion(+), 46 deletions(-)

diff --git a/features/sharding/api/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java b/features/sharding/api/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java
index b763c52ea2d..b4e60369262 100644
--- a/features/sharding/api/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java
+++ b/features/sharding/api/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java
@@ -166,6 +166,7 @@ class ShardingRuleConfigurationTest {
                 Arguments.of("Missing sharding algorithm type", createShardingAlgorithmsRuleConfiguration(
                         "foo_sharding", new AlgorithmConfiguration("MISSING", new Properties()))),
                 Arguments.of("Null key generators", nullKeyGenerators),
+                Arguments.of("Blank key generator name", createKeyGeneratorsRuleConfiguration("", algorithmConfig)),
                 Arguments.of("Null key generator", createKeyGeneratorsRuleConfiguration("foo_key_generator", null)),
                 Arguments.of("Missing key generator type", createKeyGeneratorsRuleConfiguration(
                         "foo_key_generator", new AlgorithmConfiguration("MISSING", new Properties()))),
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java
deleted file mode 100644
index 1eda68d23b6..00000000000
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java
+++ /dev/null
@@ -1,46 +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.sharding.api.config;
-
-import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.config.rule.validator.RuleConfigurationValidator;
-import org.apache.shardingsphere.infra.exception.kernel.metadata.rule.InvalidRuleConfigurationException;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.CsvSource;
-
-import java.util.Collections;
-import java.util.Properties;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-class ShardingRuleConfigurationTest {
-    
-    @ParameterizedTest(name = "{0}")
-    @CsvSource({"Existing key generator type, foo_key_generator, AUTO_INCREMENT.FIXTURE, true",
-            "Blank key generator name, '', AUTO_INCREMENT.FIXTURE, false", "Missing key generator type, foo_key_generator, MISSING, false"})
-    void assertValidateKeyGenerator(final String name, final String key, final String type, final boolean valid) {
-        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
-        ruleConfig.setKeyGenerators(Collections.singletonMap(key, new AlgorithmConfiguration(type, new Properties())));
-        if (valid) {
-            assertDoesNotThrow(() -> RuleConfigurationValidator.validate(ruleConfig));
-        } else {
-            assertThrows(InvalidRuleConfigurationException.class, () -> RuleConfigurationValidator.validate(ruleConfig));
-        }
-    }
-}