You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "yx9o (via GitHub)" <gi...@apache.org> on 2023/03/03 14:29:34 UTC

[GitHub] [shardingsphere] yx9o opened a new pull request, #24446: Add test cases for ImportDatabaseConfigurationUpdater.

yx9o opened a new pull request, #24446:
URL: https://github.com/apache/shardingsphere/pull/24446

   
   Fixes #24397.
   
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] 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.
   - [ ] 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] yx9o commented on a diff in pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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


##########
proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java:
##########
@@ -50,101 +48,89 @@
 @StaticMockSettings(ProxyContext.class)
 public final class ImportDatabaseConfigurationUpdaterTest {
     
-    private final String sharding = "sharding_db";
-    
-    private final String readwriteSplitting = "readwrite_splitting_db";
-    
-    private final String databaseDiscovery = "database_discovery_db";
-    
-    private final String encrypt = "encrypt_db";
-    
-    private final String shadow = "shadow_db";
-    
-    private final String mask = "mask_db";
-    
-    private ImportDatabaseConfigurationUpdater importDatabaseConfigurationUpdater;
-    
-    private final Map<String, String> featureMap = new HashMap<>(3, 1);
-    
-    @BeforeEach
-    public void setup() {
-        featureMap.put(sharding, "/conf/import/config-sharding.yaml");
-        featureMap.put(readwriteSplitting, "/conf/import/config-readwrite-splitting.yaml");
-        featureMap.put(databaseDiscovery, "/conf/import/config-database-discovery.yaml");
-        featureMap.put(encrypt, "/conf/import/config-encrypt.yaml");
-        featureMap.put(shadow, "/conf/import/config-shadow.yaml");
-        featureMap.put(mask, "/conf/import/config-mask.yaml");
-    }
+    private ImportDatabaseConfigurationUpdater importDatabaseConfigUpdater;
     
     @Test
+    @SneakyThrows(SQLException.class)

Review Comment:
   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] yx9o commented on a diff in pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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


##########
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java:
##########
@@ -33,6 +33,8 @@
  */
 public final class ImportDatabaseConfigurationUpdater implements RALUpdater<ImportDatabaseConfigurationStatement> {
     
+    private final YamlDatabaseConfigurationImportExecutor databaseConfigImportExecutor = new YamlDatabaseConfigurationImportExecutor();

Review Comment:
   The validateHandler in YamlDatabaseConfigurationImportExecutor needs a mock, and local variables seem to be unsolvable.



-- 
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] RaigorJiang commented on pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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

   > Yes, do I need to add one?
   
   Yes, please add some exception cases.


-- 
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] RaigorJiang merged pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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


-- 
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] RaigorJiang commented on a diff in pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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


##########
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java:
##########
@@ -33,6 +33,8 @@
  */
 public final class ImportDatabaseConfigurationUpdater implements RALUpdater<ImportDatabaseConfigurationStatement> {
     
+    private final YamlDatabaseConfigurationImportExecutor databaseConfigImportExecutor = new YamlDatabaseConfigurationImportExecutor();

Review Comment:
   No other function uses databaseConfigImportExecutor , can it be a local variable?



-- 
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] RaigorJiang commented on a diff in pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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


##########
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdater.java:
##########
@@ -33,6 +33,8 @@
  */
 public final class ImportDatabaseConfigurationUpdater implements RALUpdater<ImportDatabaseConfigurationStatement> {
     
+    private final YamlDatabaseConfigurationImportExecutor databaseConfigImportExecutor = new YamlDatabaseConfigurationImportExecutor();

Review Comment:
   Well.



-- 
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] yx9o commented on pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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

   > Hi @yx9o , after this PR, is there no exception case?
   
   Yes, do I need to add one?


-- 
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] RaigorJiang commented on a diff in pull request #24446: Add test cases for ImportDatabaseConfigurationUpdater.

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


##########
proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java:
##########
@@ -50,101 +48,89 @@
 @StaticMockSettings(ProxyContext.class)
 public final class ImportDatabaseConfigurationUpdaterTest {
     
-    private final String sharding = "sharding_db";
-    
-    private final String readwriteSplitting = "readwrite_splitting_db";
-    
-    private final String databaseDiscovery = "database_discovery_db";
-    
-    private final String encrypt = "encrypt_db";
-    
-    private final String shadow = "shadow_db";
-    
-    private final String mask = "mask_db";
-    
-    private ImportDatabaseConfigurationUpdater importDatabaseConfigurationUpdater;
-    
-    private final Map<String, String> featureMap = new HashMap<>(3, 1);
-    
-    @BeforeEach
-    public void setup() {
-        featureMap.put(sharding, "/conf/import/config-sharding.yaml");
-        featureMap.put(readwriteSplitting, "/conf/import/config-readwrite-splitting.yaml");
-        featureMap.put(databaseDiscovery, "/conf/import/config-database-discovery.yaml");
-        featureMap.put(encrypt, "/conf/import/config-encrypt.yaml");
-        featureMap.put(shadow, "/conf/import/config-shadow.yaml");
-        featureMap.put(mask, "/conf/import/config-mask.yaml");
-    }
+    private ImportDatabaseConfigurationUpdater importDatabaseConfigUpdater;
     
     @Test
+    @SneakyThrows(SQLException.class)

Review Comment:
   In test classes, `throws SQLException` is fine, SneakyThrows is not recommended



-- 
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