sunkai-cai commented on code in PR #19502:
URL: https://github.com/apache/shardingsphere/pull/19502#discussion_r928431215


##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptGeneratorBaseTest.java:
##########
@@ -30,44 +30,57 @@
 import 
org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
 import 
org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
 import 
org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptInsertValuesToken;
+import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import 
org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext;
+import 
org.apache.shardingsphere.infra.binder.statement.dml.UpdateStatementContext;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
 import 
org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.InsertValue;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.assignment.ColumnAssignmentSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.assignment.InsertValuesSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.assignment.SetAssignmentSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.InsertColumnsSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.LiteralExpressionSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.WhereSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLUpdateStatement;
 
 public abstract class EncryptGeneratorBaseTest {
     
-    protected static EncryptRuleConfiguration createEncryptRuleConfiguration() 
{
+    private static final String TABLE_NAME = "t_user";
+    
+    protected static EncryptRule createEncryptRule() {
         EncryptColumnRuleConfiguration pwdColumnConfig = new 
EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "pwd_plain", 
"test_encryptor", "test_encryptor", false);
-        return new EncryptRuleConfiguration(Collections.singleton(new 
EncryptTableRuleConfiguration("tbl", 
Collections.singletonList(pwdColumnConfig), null)),
-                Collections.singletonMap("test_encryptor", new 
ShardingSphereAlgorithmConfiguration("CORE.QUERY_ASSISTED.FIXTURE", new 
Properties())));
+        return new EncryptRule(new 
EncryptRuleConfiguration(Collections.singleton(new 
EncryptTableRuleConfiguration(TABLE_NAME, 
Collections.singletonList(pwdColumnConfig), null)),
+                Collections.singletonMap("test_encryptor", new 
ShardingSphereAlgorithmConfiguration("CORE.QUERY_ASSISTED.FIXTURE", new 
Properties()))));
     }
     
+    /**
+     * SQL: INSERT INTO t_user (id, name, status, pwd) VALUES (?, ?, ?, ?).

Review Comment:
   ok



##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptGeneratorBaseTest.java:
##########
@@ -76,6 +89,40 @@ protected static InsertStatement createInsertStatement() {
         return result;
     }
     
+    /**
+     * SQL: UPDATE t_user SET pwd = '654321' WHERE name = 'LiLei' AND pwd = 
'123456'.

Review Comment:
   ok



##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptGeneratorBaseTest.java:
##########
@@ -76,6 +89,40 @@ protected static InsertStatement createInsertStatement() {
         return result;
     }
     
+    /**
+     * SQL: UPDATE t_user SET pwd = '654321' WHERE name = 'LiLei' AND pwd = 
'123456'.
+     */
+    protected static UpdateStatementContext createUpdatesStatementContext() {
+        MySQLUpdateStatement mySQLUpdateStatement = new MySQLUpdateStatement();
+        mySQLUpdateStatement.setTableSegment(createTableSegment(TABLE_NAME));
+        mySQLUpdateStatement.setWhere(createWhereSegment());
+        mySQLUpdateStatement.setSetAssignment(createSetAssignmentSegment());
+        return new UpdateStatementContext(mySQLUpdateStatement);
+    }
+    
+    /**
+     * SQL-template: WHERE name = 'LiLei' AND pwd = '123456'.

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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to