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 37926591af6 Add RuleConfigurationTest (#37135)
37926591af6 is described below

commit 37926591af688c03c071b5e971a359ae71f5c260
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Nov 18 15:57:53 2025 +0800

    Add RuleConfigurationTest (#37135)
    
    * Add EncryptRuleConfigurationTest
    
    * Add RuleConfigurationTest
---
 .../config/BroadcastRuleConfigurationTest.java     | 40 ++++++++++++++++++++
 .../config/EncryptRuleConfigurationTest.java       | 43 ++++++++++++++++++++++
 .../mask/config/MaskRuleConfigurationTest.java     | 43 ++++++++++++++++++++++
 .../api/config/ShardingRuleConfigurationTest.java  | 43 ++++++++++++++++++++++
 4 files changed, 169 insertions(+)

diff --git 
a/features/broadcast/api/src/test/java/org/apache/shardingsphere/broadcast/config/BroadcastRuleConfigurationTest.java
 
b/features/broadcast/api/src/test/java/org/apache/shardingsphere/broadcast/config/BroadcastRuleConfigurationTest.java
new file mode 100644
index 00000000000..a7265d41120
--- /dev/null
+++ 
b/features/broadcast/api/src/test/java/org/apache/shardingsphere/broadcast/config/BroadcastRuleConfigurationTest.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.shardingsphere.broadcast.config;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class BroadcastRuleConfigurationTest {
+    
+    @Test
+    void assertGetLogicTableNames() {
+        Collection<String> actual = new 
BroadcastRuleConfiguration(Arrays.asList("foo_tbl", 
"bar_tbl")).getLogicTableNames();
+        assertThat(actual.size(), is(2));
+        assertTrue(actual.contains("foo_tbl"));
+        assertTrue(actual.contains("bar_tbl"));
+        assertTrue(actual.contains("FOO_TBL"));
+        assertTrue(actual.contains("BAR_tbl"));
+    }
+}
diff --git 
a/features/encrypt/api/src/test/java/org/apache/shardingsphere/encrypt/config/EncryptRuleConfigurationTest.java
 
b/features/encrypt/api/src/test/java/org/apache/shardingsphere/encrypt/config/EncryptRuleConfigurationTest.java
new file mode 100644
index 00000000000..915f73ee68a
--- /dev/null
+++ 
b/features/encrypt/api/src/test/java/org/apache/shardingsphere/encrypt/config/EncryptRuleConfigurationTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.encrypt.config;
+
+import 
org.apache.shardingsphere.encrypt.config.rule.EncryptTableRuleConfiguration;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class EncryptRuleConfigurationTest {
+    
+    @Test
+    void assertGetLogicTableNames() {
+        Collection<String> actual = new EncryptRuleConfiguration(Arrays.asList(
+                new EncryptTableRuleConfiguration("foo_tbl", 
Collections.emptyList()), new EncryptTableRuleConfiguration("bar_tbl", 
Collections.emptyList())), null).getLogicTableNames();
+        assertThat(actual.size(), is(2));
+        assertTrue(actual.contains("foo_tbl"));
+        assertTrue(actual.contains("bar_tbl"));
+        assertTrue(actual.contains("FOO_TBL"));
+        assertTrue(actual.contains("BAR_tbl"));
+    }
+}
diff --git 
a/features/mask/api/src/test/java/org/apache/shardingsphere/mask/config/MaskRuleConfigurationTest.java
 
b/features/mask/api/src/test/java/org/apache/shardingsphere/mask/config/MaskRuleConfigurationTest.java
new file mode 100644
index 00000000000..6f7f55947a3
--- /dev/null
+++ 
b/features/mask/api/src/test/java/org/apache/shardingsphere/mask/config/MaskRuleConfigurationTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.mask.config;
+
+import org.apache.shardingsphere.mask.config.rule.MaskTableRuleConfiguration;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class MaskRuleConfigurationTest {
+    
+    @Test
+    void assertGetLogicTableNames() {
+        Collection<String> actual = new MaskRuleConfiguration(Arrays.asList(
+                new MaskTableRuleConfiguration("foo_tbl", 
Collections.emptyList()), new MaskTableRuleConfiguration("bar_tbl", 
Collections.emptyList())), null).getLogicTableNames();
+        assertThat(actual.size(), is(2));
+        assertTrue(actual.contains("foo_tbl"));
+        assertTrue(actual.contains("bar_tbl"));
+        assertTrue(actual.contains("FOO_TBL"));
+        assertTrue(actual.contains("BAR_tbl"));
+    }
+}
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
new file mode 100644
index 00000000000..37f6048cec8
--- /dev/null
+++ 
b/features/sharding/api/src/test/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfigurationTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class ShardingRuleConfigurationTest {
+    
+    @Test
+    void assertGetLogicTableNames() {
+        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+        ruleConfig.getTables().addAll(Arrays.asList(new 
ShardingTableRuleConfiguration("foo_tbl", "foo_tbl_0"), new 
ShardingTableRuleConfiguration("bar_tbl", "bar_tbl_0")));
+        Collection<String> actual = ruleConfig.getLogicTableNames();
+        assertThat(actual.size(), is(2));
+        assertTrue(actual.contains("foo_tbl"));
+        assertTrue(actual.contains("bar_tbl"));
+        assertTrue(actual.contains("FOO_TBL"));
+        assertTrue(actual.contains("BAR_tbl"));
+    }
+}

Reply via email to