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


##########
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'.
+     */
+    private static WhereSegment createWhereSegment() {
+        BinaryOperationExpression nameExpression = new 
BinaryOperationExpression(10, 24,
+                new ColumnSegment(10, 13, new IdentifierValue("name")), new 
LiteralExpressionSegment(18, 22, "LiLei"), "=", "name = 'LiLei'");
+        BinaryOperationExpression pwdExpression = new 
BinaryOperationExpression(30, 44,
+                new ColumnSegment(30, 32, new IdentifierValue("pwd")), new 
LiteralExpressionSegment(40, 45, "123456"), "=", "pwd = '123456'");
+        return new WhereSegment(0, 0, new BinaryOperationExpression(0, 0, 
nameExpression, pwdExpression, "AND", "name = 'LiLei' AND pwd = '123456'"));
+    }
+    
+    /**
+     * SQL-template: SET pwd = '654321'.

Review Comment:
   ok



##########
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGeneratorTest.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * 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.rewrite.token.generator;
+
+import org.apache.shardingsphere.infra.database.DefaultDatabase;
+import 
org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.SubstitutableColumnNameToken;
+import org.junit.Test;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public class EncryptPredicateColumnTokenGeneratorTest extends 
EncryptGeneratorBaseTest {

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