You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "dmytro-taranov (via GitHub)" <gi...@apache.org> on 2023/05/23 04:05:46 UTC

[GitHub] [shardingsphere] dmytro-taranov opened a new pull request, #25860: Add junit test for UnusedAlgorithmFinder (#25730)

dmytro-taranov opened a new pull request, #25860:
URL: https://github.com/apache/shardingsphere/pull/25860

   Fixes #ISSUSE_ID.
   
   Changes proposed in this pull request:
     -
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [x] I have (or in comment I request) added corresponding labels for the pull request.
   - [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz merged pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz merged PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] dmytro-taranov commented on a diff in pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "dmytro-taranov (via GitHub)" <gi...@apache.org>.
dmytro-taranov commented on code in PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860#discussion_r1203690545


##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class UnusedAlgorithmFinderTest {
+    
+    private static final String USED_TABLE_SHARDING_ALGORITHM = "used_table_sharding_algorithm";
+    
+    private static final String USED_TABLE_SHARDING_DEFAULT_ALGORITHM = "used_table_sharding_default_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_ALGORITHM = "used_database_sharding_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_DEFAULT_ALGORITHM = "used_database_sharding_default_algorithm";
+    
+    private static final String UNUSED_ALGORITHM = "unused_algorithm";
+    
+    @Test
+    void assertFind() {
+        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+        
+        ShardingTableRuleConfiguration shardingTableRuleConfiguration = getShardingTableRuleConfiguration();
+        Map<String, AlgorithmConfiguration> allAlgorithms = getAlgorithms();

Review Comment:
   Okay, thanks for the hint. Changed 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on code in PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860#discussion_r1204059558


##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;

Review Comment:
   Sorry, that's my mistake. I tested on my local machine, that's OK.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] dmytro-taranov commented on a diff in pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "dmytro-taranov (via GitHub)" <gi...@apache.org>.
dmytro-taranov commented on code in PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860#discussion_r1203699238


##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;

Review Comment:
   @sandynz I imported this file and formatted the code before the first commit. Unfortunately, after second reformatting the situation with the imports did not change. I also checked the imports in other classes, and the logic of their arrangement is the same as mine. Could you please point out what exactly is wrong with imports? I'd appreciate it, and I'll fix them.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860#issuecomment-1561082949

   > Hi. @sandynz. Thanks for the review. And thanks for the hint. I will double-check the code of conduct
   
   Nice. Looking forward to more contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on code in PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860#discussion_r1202242176


##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class UnusedAlgorithmFinderTest {
+    
+    private static final String USED_TABLE_SHARDING_ALGORITHM = "used_table_sharding_algorithm";
+    
+    private static final String USED_TABLE_SHARDING_DEFAULT_ALGORITHM = "used_table_sharding_default_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_ALGORITHM = "used_database_sharding_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_DEFAULT_ALGORITHM = "used_database_sharding_default_algorithm";
+    
+    private static final String UNUSED_ALGORITHM = "unused_algorithm";
+    
+    @Test
+    void assertFind() {
+        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+        

Review Comment:
   The empty lines in method could be removed for clean code



##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;

Review Comment:
   You could import `src/resources/code-style-idea.xml` in IDEA and format importing



##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class UnusedAlgorithmFinderTest {
+    
+    private static final String USED_TABLE_SHARDING_ALGORITHM = "used_table_sharding_algorithm";
+    
+    private static final String USED_TABLE_SHARDING_DEFAULT_ALGORITHM = "used_table_sharding_default_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_ALGORITHM = "used_database_sharding_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_DEFAULT_ALGORITHM = "used_database_sharding_default_algorithm";
+    
+    private static final String UNUSED_ALGORITHM = "unused_algorithm";
+    
+    @Test
+    void assertFind() {
+        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+        
+        ShardingTableRuleConfiguration shardingTableRuleConfiguration = getShardingTableRuleConfiguration();

Review Comment:
   `shardingTableRuleConfiguration` name could be `shardingTableRuleConfig` for less code



##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class UnusedAlgorithmFinderTest {
+    
+    private static final String USED_TABLE_SHARDING_ALGORITHM = "used_table_sharding_algorithm";
+    
+    private static final String USED_TABLE_SHARDING_DEFAULT_ALGORITHM = "used_table_sharding_default_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_ALGORITHM = "used_database_sharding_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_DEFAULT_ALGORITHM = "used_database_sharding_default_algorithm";
+    
+    private static final String UNUSED_ALGORITHM = "unused_algorithm";
+    
+    @Test
+    void assertFind() {
+        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+        
+        ShardingTableRuleConfiguration shardingTableRuleConfiguration = getShardingTableRuleConfiguration();
+        Map<String, AlgorithmConfiguration> allAlgorithms = getAlgorithms();

Review Comment:
   `allAlgorithms` could be removed and embed `getAlgorithms()` in `putAll`



##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class UnusedAlgorithmFinderTest {
+    
+    private static final String USED_TABLE_SHARDING_ALGORITHM = "used_table_sharding_algorithm";
+    
+    private static final String USED_TABLE_SHARDING_DEFAULT_ALGORITHM = "used_table_sharding_default_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_ALGORITHM = "used_database_sharding_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_DEFAULT_ALGORITHM = "used_database_sharding_default_algorithm";
+    
+    private static final String UNUSED_ALGORITHM = "unused_algorithm";
+    
+    @Test
+    void assertFind() {
+        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+        
+        ShardingTableRuleConfiguration shardingTableRuleConfiguration = getShardingTableRuleConfiguration();
+        Map<String, AlgorithmConfiguration> allAlgorithms = getAlgorithms();
+        
+        ruleConfig.getTables().add(shardingTableRuleConfiguration);
+        ruleConfig.getShardingAlgorithms().putAll(allAlgorithms);
+        ruleConfig.setDefaultDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", USED_DATABASE_SHARDING_DEFAULT_ALGORITHM));
+        ruleConfig.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", USED_TABLE_SHARDING_DEFAULT_ALGORITHM));
+        
+        Collection<String> unusedAlgorithmsCollection = UnusedAlgorithmFinder.find(ruleConfig);
+        
+        assertNotNull(unusedAlgorithmsCollection);
+        assertThat(unusedAlgorithmsCollection.size(), is(1));
+        assertTrue(unusedAlgorithmsCollection.contains(UNUSED_ALGORITHM));
+    }
+    
+    private ShardingTableRuleConfiguration getShardingTableRuleConfiguration() {
+        ShardingTableRuleConfiguration shardingTableRuleConfiguration = new ShardingTableRuleConfiguration("t_order", null);
+        shardingTableRuleConfiguration.setTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", USED_TABLE_SHARDING_ALGORITHM));
+        shardingTableRuleConfiguration.setDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", USED_DATABASE_SHARDING_ALGORITHM));
+        
+        return shardingTableRuleConfiguration;

Review Comment:
   `shardingTableRuleConfiguration` name could be `result`



##########
features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/UnusedAlgorithmFinderTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.distsql.update;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.distsql.handler.update.UnusedAlgorithmFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class UnusedAlgorithmFinderTest {
+    
+    private static final String USED_TABLE_SHARDING_ALGORITHM = "used_table_sharding_algorithm";
+    
+    private static final String USED_TABLE_SHARDING_DEFAULT_ALGORITHM = "used_table_sharding_default_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_ALGORITHM = "used_database_sharding_algorithm";
+    
+    private static final String USED_DATABASE_SHARDING_DEFAULT_ALGORITHM = "used_database_sharding_default_algorithm";
+    
+    private static final String UNUSED_ALGORITHM = "unused_algorithm";
+    
+    @Test
+    void assertFind() {
+        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+        
+        ShardingTableRuleConfiguration shardingTableRuleConfiguration = getShardingTableRuleConfiguration();
+        Map<String, AlgorithmConfiguration> allAlgorithms = getAlgorithms();
+        
+        ruleConfig.getTables().add(shardingTableRuleConfiguration);
+        ruleConfig.getShardingAlgorithms().putAll(allAlgorithms);
+        ruleConfig.setDefaultDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", USED_DATABASE_SHARDING_DEFAULT_ALGORITHM));
+        ruleConfig.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", USED_TABLE_SHARDING_DEFAULT_ALGORITHM));
+        
+        Collection<String> unusedAlgorithmsCollection = UnusedAlgorithmFinder.find(ruleConfig);

Review Comment:
   `unusedAlgorithmsCollection` name could be `actual`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860#issuecomment-1559210777

   Hi @dmytro-taranov , thanks for your contribution.
   
   Since this is your first contribution, you could have a look at [Code of Conduct]( https://shardingsphere.apache.org/community/en/involved/conduct/code/ )
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] dmytro-taranov commented on pull request #25860: Add junit test for UnusedAlgorithmFinder

Posted by "dmytro-taranov (via GitHub)" <gi...@apache.org>.
dmytro-taranov commented on PR #25860:
URL: https://github.com/apache/shardingsphere/pull/25860#issuecomment-1560687646

   Hi. @sandynz. Thanks for the review. And thanks for the hint. I will double-check the code of conduct


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org