You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/29 11:08:49 UTC

[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #21808: support the fuzzyQueryColumn and fuzzyQueryEncryptorName for distsql and UT, SIT

strongduanmu commented on code in PR #21808:
URL: https://github.com/apache/shardingsphere/pull/21808#discussion_r1008681825


##########
features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java:
##########
@@ -123,28 +123,47 @@ public void assertFindPlainColumn() {
         assertFalse(new EncryptRule(createEncryptRuleConfiguration()).findPlainColumn("t_encrypt", "notExistLogicColumn").isPresent());
     }
     
+    @Test
+    public void assertFindFuzzyQueryColumn() {
+        assertFalse(new EncryptRule(createEncryptRuleConfiguration()).findFuzzyQueryColumn("t_encrypt", "pwd_cipher").isPresent());
+    }
+    
+    @Test
+    public void assertGetEncryptFuzzyQueryValues() {
+        List<Object> encryptFuzzyQueryValues = new EncryptRule(createEncryptRuleConfiguration())
+                .getEncryptFuzzyQueryValues(DefaultDatabase.LOGIC_NAME, DefaultDatabase.LOGIC_NAME, "t_encrypt", "pwd", Collections.singletonList(null));
+        for (final Object value : encryptFuzzyQueryValues) {

Review Comment:
   Please remove final and rename value to each.



##########
features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java:
##########
@@ -123,28 +123,47 @@ public void assertFindPlainColumn() {
         assertFalse(new EncryptRule(createEncryptRuleConfiguration()).findPlainColumn("t_encrypt", "notExistLogicColumn").isPresent());
     }
     
+    @Test
+    public void assertFindFuzzyQueryColumn() {
+        assertFalse(new EncryptRule(createEncryptRuleConfiguration()).findFuzzyQueryColumn("t_encrypt", "pwd_cipher").isPresent());
+    }
+    
+    @Test
+    public void assertGetEncryptFuzzyQueryValues() {
+        List<Object> encryptFuzzyQueryValues = new EncryptRule(createEncryptRuleConfiguration())
+                .getEncryptFuzzyQueryValues(DefaultDatabase.LOGIC_NAME, DefaultDatabase.LOGIC_NAME, "t_encrypt", "pwd", Collections.singletonList(null));
+        for (final Object value : encryptFuzzyQueryValues) {
+            assertNull(value);
+        }
+    }
+    
+    @Test
+    public void assertGetFuzzyQueryColumns() {
+        assertFalse(new EncryptRule(createEncryptRuleConfiguration()).getFuzzyQueryColumns("t_encrypt").isEmpty());
+    }
+    
     @Test
     public void assertIsQueryWithCipherColumn() {
-        EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor", null);
+        EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "", "test_encryptor", null);
         EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig), null);
         AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration(
                 Collections.singleton(tableConfig), Collections.singletonMap("test_encryptor", new CoreEncryptAlgorithmFixture()), true);
         EncryptRule actual = new EncryptRule(ruleConfig);
         assertTrue(actual.isQueryWithCipherColumn("t_encrypt", "encrypt_column"));
         

Review Comment:
   Please remove useless blank line here.



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