This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c04e0d8626 Add mask and encrypt integration test (#23336)
1c04e0d8626 is described below

commit 1c04e0d86266167f271b365da873843cb8cf9c63
Author: gxxiong <[email protected]>
AuthorDate: Thu Jan 5 14:47:57 2023 +0800

    Add mask and encrypt integration test (#23336)
    
    * Add mask and encrypt integration test
    
    * format code
    
    * format code
    
    * format code
---
 .github/workflows/e2e.yml                          |  4 +-
 .../cases/dql/dql-integration-test-cases.xml       |  8 +--
 .../suite/src/test/resources/env/it-env.properties |  4 +-
 .../env/scenario/mask_encrypt/authority.xml        | 79 ++++++++++++++++++++++
 .../mask_encrypt/data/actual/databases.xml         | 21 ++++++
 .../scenario/mask_encrypt/data/actual/dataset.xml  | 49 ++++++++++++++
 .../data/actual/init-sql/h2/01-actual-init.sql     | 19 ++++++
 .../data/actual/init-sql/mysql/01-actual-init.sql  | 24 +++++++
 .../actual/init-sql/opengauss/01-actual-init.sql   | 26 +++++++
 .../data/actual/init-sql/oracle/01-actual-init.sql | 21 ++++++
 .../actual/init-sql/postgresql/01-actual-init.sql  | 26 +++++++
 .../actual/init-sql/sqlserver/01-actual-init.sql   | 21 ++++++
 .../mask_encrypt/data/expected/databases.xml       | 21 ++++++
 .../mask_encrypt/data/expected/dataset.xml         | 47 +++++++++++++
 .../data/expected/init-sql/h2/01-expected-init.sql | 20 ++++++
 .../expected/init-sql/mysql/01-expected-init.sql   | 24 +++++++
 .../init-sql/opengauss/01-expected-init.sql        | 27 ++++++++
 .../expected/init-sql/oracle/01-expected-init.sql  | 21 ++++++
 .../init-sql/postgresql/01-expected-init.sql       | 27 ++++++++
 .../init-sql/sqlserver/01-expected-init.sql        | 22 ++++++
 .../proxy/conf/mysql/config-mask-encrypt.yaml      | 78 +++++++++++++++++++++
 .../proxy/conf/opengauss/config-mask-encrypt.yaml  | 78 +++++++++++++++++++++
 .../proxy/conf/postgresql/config-mask-encrypt.yaml | 78 +++++++++++++++++++++
 .../resources/env/scenario/mask_encrypt/rules.yaml | 65 ++++++++++++++++++
 24 files changed, 802 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index c381db3beca..c6721fdc1df 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -133,7 +133,7 @@ jobs:
         adapter: [ proxy, jdbc ]
         mode: [ Standalone, Cluster ]
         database: [ MySQL, PostgreSQL, openGauss ]
-        scenario: [ db, tbl, encrypt, readwrite_splitting, shadow ]
+        scenario: [ db, tbl, encrypt, readwrite_splitting, shadow, mask ]
         exclude:
           - adapter: jdbc
             mode: Cluster
@@ -169,7 +169,7 @@ jobs:
         adapter: [ proxy, jdbc ]
         mode: [ Standalone, Cluster ]
         database: [ MySQL, PostgreSQL, openGauss ]
-        scenario: [ dbtbl_with_readwrite_splitting, 
dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, 
encrypt_and_readwrite_splitting, encrypt_shadow, 
readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow ]
+        scenario: [ dbtbl_with_readwrite_splitting, 
dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, 
encrypt_and_readwrite_splitting, encrypt_shadow, 
readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, 
mask_encrypt ]
         exclude:
           - adapter: jdbc
             mode: Cluster
diff --git 
a/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml 
b/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
index 249d46f2544..3a5586b21bf 100644
--- a/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
+++ b/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
@@ -1291,19 +1291,19 @@
         <assertion parameters="foo:String" 
expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM t_user" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask">
+    <test-case sql="SELECT * FROM t_user" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT u1.* FROM t_user u1 INNER JOIN t_user u2 ON 
u1.user_id = u2.user_id" db-types="MySQL,PostgreSQL,openGauss" 
scenario-types="mask">
+    <test-case sql="SELECT u1.* FROM t_user u1 INNER JOIN t_user u2 ON 
u1.user_id = u2.user_id" db-types="MySQL,PostgreSQL,openGauss" 
scenario-types="mask,mask_encrypt">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM (SELECT * FROM t_user) temp" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask">
+    <test-case sql="SELECT * FROM (SELECT * FROM t_user) temp" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM (SELECT u1.* FROM t_user u1 INNER JOIN 
t_user u2 ON u1.user_id = u2.user_id) temp" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask">
+    <test-case sql="SELECT * FROM (SELECT u1.* FROM t_user u1 INNER JOIN 
t_user u2 ON u1.user_id = u2.user_id) temp" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
 </integration-test-cases>
diff --git a/test/e2e/suite/src/test/resources/env/it-env.properties 
b/test/e2e/suite/src/test/resources/env/it-env.properties
index f3464b8561f..115300a1f88 100644
--- a/test/e2e/suite/src/test/resources/env/it-env.properties
+++ b/test/e2e/suite/src/test/resources/env/it-env.properties
@@ -19,8 +19,8 @@
 it.run.modes=
 it.run.additional.cases=false
 
-#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow
-it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow
+#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt
+it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt
 
 # it.cluster.env.type=DOCKER,NATIVE
 it.cluster.env.type=DOCKER
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/authority.xml 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/authority.xml
new file mode 100644
index 00000000000..77538802a58
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/authority.xml
@@ -0,0 +1,79 @@
+<!--
+  ~ 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.
+  -->
+
+<authority>
+    <sqlset db-types="Oracle,SQLServer,PostgreSQL,openGauss">
+        <user-create>
+            <sql>CREATE USER default_user</sql>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE ROLE role2</sql>
+            <sql>CREATE ROLE role3</sql>
+            <sql>CREATE ROLE role4</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>DROP ROLE IF EXISTS role2</sql>
+            <sql>DROP ROLE IF EXISTS role3</sql>
+            <sql>DROP ROLE IF EXISTS role4</sql>
+            <sql>DROP USER IF EXISTS user_dev</sql>
+            <sql>DROP USER IF EXISTS user_dev_new</sql>
+            <sql>DROP USER IF EXISTS default_user</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="SQLServer">
+        <user-create>
+            <sql>CREATE LOGIN login_dev</sql>
+            <sql>CREATE USER user_dev FOR LOGIN login_dev</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP LOGIN IF EXISTS login_dev</sql>
+            <sql>DROP LOGIN IF EXISTS login_dev_new</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="MySQL">
+        <user-create>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE USER user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_0.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_1.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_2.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_3.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_4.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_5.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_6.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_7.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_8.* to 
user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt_ds_9.* to 
user_dev@localhost</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP USER IF EXISTS user_dev@localhost</sql>
+            <sql>DROP USER IF EXISTS user_dev_new@localhost</sql>
+            <sql>DROP USER IF EXISTS [email protected]</sql>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>FLUSH PRIVILEGES</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="Oracle">
+        <user-create>
+            <sql>CREATE USER user_dev identified by passwd_dev</sql>
+        </user-create>
+    </sqlset>
+</authority>
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/databases.xml
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/databases.xml
new file mode 100644
index 00000000000..d4a48c4f8f9
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/databases.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<databases>
+    <database>mask_encrypt</database>
+</databases>
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/dataset.xml
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/dataset.xml
new file mode 100644
index 00000000000..c92fc66ebfc
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/dataset.xml
@@ -0,0 +1,49 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset>
+    <metadata data-nodes="mask_encrypt.t_user">
+        <column name="user_id" type="numeric" />
+        <column name="user_name_cipher" type="varchar" />
+        <column name="user_name_plain" type="varchar" />
+        <column name="password_cipher" type="varchar" />
+        <column name="email_cipher" type="varchar" />
+        <column name="telephone_cipher" type="varchar" />
+        <column name="telephone_plain" type="varchar" />
+        <column name="creation_date" type="datetime" />
+    </metadata>
+    <row data-node="mask_encrypt.t_user" values="10, sVq8Lmm+j6bZE5EKSilJEQ==, 
zhangsan, aQol0b6th65d0aXe+zFPsQ==, 
WM0fHOH91JNWnHTkiqBdyNmzk4uJ7CCz4mB1va9Ya1M=, kLjLJIMnfyHT2nA+viaoaQ==, 
12345678900,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="11, fQ7IzBxKVuNHtUF6h6WSBg==, 
lisi, wuhmEKgdgrWQYt+Ev0hgGA==, svATu3uWv9KfiloWJeWx3A==, 
0kDFxndQdzauFwL/wyCsNQ==, 12345678901,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="12, AQRWSlufQPog/b64YRhu6Q==, 
wangwu, x7A+2jq9B6DSOSFtSOibdA==, nHJv9e6NiClIuGHOjHLvCAq2ZLhWcqfQ8/EQnIqMx+g=, 
a/SzSJLapt5iBXvF2c9ycw==, 12345678902,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="13, 5NqS4YvpT+mHBFqZOZ3QDA==, 
zhaoliu, zi6b4xYRjjV+bBk2R4wB+w==, 
MLBZczLjriUXvg3aM5QPTxMJbLjNh8yeNrSNBek/VTw=, b6VVhG+F6ujG8IMUZJAIFg==, 
12345678903,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="14, qeIY9od3u1KwhjihzLQUTQ==, 
zhuqi, 51UmlLAC+tUvdOAj8CjWfQ==, JCmeNdPyrKO5BW5zvhAA+g==, 
f995xinpZdKMVU5J5/yv3w==, 12345678904,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="15, VbNUtguwtpeGhHGnPJ3aXg==, 
liba, +3/5CVbqoKhg3sqznKTFFQ==, T+X+e3Q3+ZNIXXmg/80uxg==, 
GETj+S6DrO042E7NuBXLBQ==, 12345678905,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="16, U0/Ao/w1u7L5avR3fAH2Og==, 
wangjiu, jFfFMYxv02DjaFRuAoCDGw==, 
RNW/KRq5HeL2YTfAdXSyARMJbLjNh8yeNrSNBek/VTw=, +lbvjJwO7VO4HUKc0Mw0NA==, 
12345678906,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="17, zb1sgBigoMi7JPSoY4bAVw==, 
zhuda, VFIjocgjujJCJc6waWXqJA==, 1vF/ET3nBxt7T7vVfAndZQ==, 
wFvs5BH6OikgveBeTEBwsQ==, 12345678907,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="18, rJzNIrFEnx296kW+N1YmMw==, 
suner, LaODSKGyR7vZ1IvmBOe9vA==, 5u4GIQkJsWRmnJHWaHNSjg==, 
uwqm2O1Lv2tNTraJX1ym7Q==, 12345678908,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="19, qHwpQ9kteL8VX6iTUhNdbQ==, 
zhousan, MyOShk4kjRnds7CZfU5NCw==, 
HmYCo7QBfJ2E0EvaGHBCOBMJbLjNh8yeNrSNBek/VTw=, YLNQuuUPMGA21nhKWPzzsg==, 
12345678909,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="20, qCCmvf7OWRxbVbtLb0az1g==, 
tom, fzdTMkzpBvgNYmKSQAp8Fg==, gOoP4Mf0P4ISOJp6A4sRmg==, 
l4xa4HwOfs/jusoJon9Wzw==, 12345678910,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="21, IYJ1COaRQ0gSjWMC/UAeMg==, 
kobe, 1uEDMeYh2jstbOf6kx/cqw==, tikMAFiQ37u2VgWqUT38Eg==, 
rGpr30UXfczXjCjdvPN+BA==, 12345678911,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="22, 7wvZZ7NVHgk6m1vB/sTC1Q==, 
jerry, OirN3gvz9uBnrq88nfa1wQ==, T7K/Uz1O2m+3xvB0+c4nGQ==, 
7+fCU+VbQZKgLJXZPTTegA==, 12345678912,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="23, SbVQWl8JbnxflCfGJ7KZdA==, 
james, hWVVYdkdTUTgm08haeq+tw==, Uk3ju6GteCD1qEHns5ZhKA==, 
DpnV86FZefwBRmIAVBh2gg==, 12345678913,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="24, fx7OfSAYqVpjNa7LoKhXvw==, 
wade, N2W9ijAXNkBxhkvJiIwp0A==, lAAGItVLmb1H69++1MDrIA==, 
QrE62wAb8B+2cEPcs4Lm1Q==, 12345678914,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="25, wH3/LdWShD9aCb8eCIm3Tg==, 
rose, GDixtt6NzPOVv6H0dmov5g==, T1yfJSyVxumZUfkDnmUQxA==, 
iU+AsGczboCRfU+Zr7mcpw==, 12345678915,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="26, GgJQTndbxyBZ2tECS8SmqQ==, 
bosh, gLgVFLFIyyKwdQCXaw78Ag==, O+JIn9XZ3yq6RnKElHuqlA==, 
kwYlbu9aF7ndvMTcj8QBSg==, 12345678916,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="27, lv8w8g32kuTXNvSUUypOig==, 
jack, 8i0YH2mn6kXSyvBjM5p+Yg==, gqRoJF5S66SvBalc2RCo1A==, 
2ob/3UYqRsZA5VdScnaWxQ==, 12345678917,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="28, P9YCbFvWCIhcS99KyKH2zA==, 
jordan, PRrI4z4FrWwLvcHPx9g4og==, y8q31Jj4PFSyZHiLVIxKEQq2ZLhWcqfQ8/EQnIqMx+g=, 
kDF2za26uOerlNYWYHRT2Q==, 12345678918,  2017-08-08" />
+    <row data-node="mask_encrypt.t_user" values="29, 5wu9XvlJAVtjKijhxt6SQQ==, 
julie, O4pgkLgz34N+C4bIUOQVnA==, UH7ihg16J61Np/EYMQnXIA==, 
z2hbJQD4dRkVVITNxAac5Q==, 12345678919,  2017-08-08" />
+</dataset>
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/h2/01-actual-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/h2/01-actual-init.sql
new file mode 100644
index 00000000000..74e4060837d
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/h2/01-actual-init.sql
@@ -0,0 +1,19 @@
+--
+-- 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.
+--
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT 
NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT 
NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, 
telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/mysql/01-actual-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/mysql/01-actual-init.sql
new file mode 100644
index 00000000000..a56bfbb4216
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/mysql/01-actual-init.sql
@@ -0,0 +1,24 @@
+--
+-- 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.
+--
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS mask_encrypt;
+CREATE DATABASE mask_encrypt;
+
+CREATE TABLE mask_encrypt.t_user (user_id INT PRIMARY KEY, user_name_cipher 
VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher 
VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher 
CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT 
NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/opengauss/01-actual-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/opengauss/01-actual-init.sql
new file mode 100644
index 00000000000..e17449129ca
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/opengauss/01-actual-init.sql
@@ -0,0 +1,26 @@
+--
+-- 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.
+--
+
+CREATE DATABASE mask_encrypt;
+
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt TO test_user;
+
+\c mask_encrypt
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT 
NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT 
NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, 
telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/oracle/01-actual-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/oracle/01-actual-init.sql
new file mode 100644
index 00000000000..d3b847dcb2d
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/oracle/01-actual-init.sql
@@ -0,0 +1,21 @@
+--
+-- 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.
+--
+
+DROP SCHEMA mask_encrypt;
+CREATE SCHEMA mask_encrypt;
+
+CREATE TABLE mask_encrypt.t_user (user_id INT PRIMARY KEY, user_name_cipher 
VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher 
VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher 
CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT 
NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/postgresql/01-actual-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/postgresql/01-actual-init.sql
new file mode 100644
index 00000000000..e17449129ca
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/postgresql/01-actual-init.sql
@@ -0,0 +1,26 @@
+--
+-- 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.
+--
+
+CREATE DATABASE mask_encrypt;
+
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt TO test_user;
+
+\c mask_encrypt
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT 
NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT 
NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, 
telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/sqlserver/01-actual-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/sqlserver/01-actual-init.sql
new file mode 100644
index 00000000000..e24d14008fd
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/actual/init-sql/sqlserver/01-actual-init.sql
@@ -0,0 +1,21 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS mask_encrypt;
+CREATE DATABASE mask_encrypt;
+
+CREATE TABLE mask_encrypt.t_user (user_id INT PRIMARY KEY, user_name_cipher 
VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher 
VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher 
CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT 
NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/databases.xml
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/databases.xml
new file mode 100644
index 00000000000..9e98dc8baea
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/databases.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<databases>
+    <database>expected_dataset</database>
+</databases>
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/dataset.xml
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/dataset.xml
new file mode 100644
index 00000000000..1901d4dcb81
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/dataset.xml
@@ -0,0 +1,47 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset>
+    <metadata data-nodes="expected_dataset.t_user">
+        <column name="user_id" type="numeric" />
+        <column name="user_name" type="varchar" />
+        <column name="password" type="varchar" />
+        <column name="email" type="varchar" />
+        <column name="telephone" type="varchar" />
+        <column name="creation_date" type="datetime" />
+    </metadata>
+    <row data-node="expected_dataset.t_user" values="10, zhangsan, 
96e79218965eb72c92a549dd5a330112, ********@gmail.com, 123****8900, 2017-08-08" 
/>
+    <row data-node="expected_dataset.t_user" values="11, lisi, 
e3ceb5881a0a1fdaad01296d7554868d, ****@gmail.com, 123****8901, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="12, wangwu, 
1a100d2c0dab19c4430e7d73762b3423, ******@gmail.com, 123****8902, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="13, zhaoliu, 
73882ab1fa529d7273da0db6b49cc4f3, *******@gmail.com, 123****8903, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="14, zhuqi, 
5b1b68a9abf4d2cd155c81a9225fd158, *****@gmail.com, 123****8904, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="15, liba, 
f379eaf3c831b04de153469d1bec345e, ****@gmail.com, 123****8905, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="16, wangjiu, 
f63f4fbc9f8c85d409f2f59f2b9e12d5, *******@gmail.com, 123****8906, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="17, zhuda, 
21218cca77804d2ba1922c33e0151105, *****@gmail.com, 123****8907, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="18, suner, 
52c69e3a57331081823331c4e69d3f2e, *****@gmail.com, 123****8908, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="19, zhousan, 
e10adc3949ba59abbe56e057f20f883e, *******@gmail.com, 123****8909, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="20, tom, 
508df4cb2f4d8f80519256258cfb975f, ***@gmail.com, 123****8910, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="21, kobe, 
5bd2026f128662763c532f2f4b6f2476, ****@gmail.com, 123****8911, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="22, jerry, 
e35cf7b66449df565f93c607d5a81d09, *****@gmail.com, 123****8912, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="23, james, 
ba00819f263287af1ff0100c5a323355, *****@gmail.com, 123****8913, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="24, wade, 
d6a9a933c8aafc51e55ac0662b6e4d4a, ****@gmail.com, 123****8914, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="25, rose, 
670b14728ad9902aecba32e22fa4f6bd, ****@gmail.com, 123****8915, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="26, bosh, 
00b7691d86d96aebd21dd9e138f90840, ****@gmail.com, 123****8916, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="27, jack, 
731982a033a5cc815ac03c8504abb748, ****@gmail.com, 123****8917, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="28, jordan, 
abf156f3cf64496f9da2cabca68d95fe, ******@gmail.com, 123****8918, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="29, julie, 
01c401bb1b2ba502df5a854be02ea4e9, *****@gmail.com, 123****8919, 2017-08-08" />
+</dataset>
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/h2/01-expected-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/h2/01-expected-init.sql
new file mode 100644
index 00000000000..7472146bbf1
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/h2/01-expected-init.sql
@@ -0,0 +1,20 @@
+--
+-- 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.
+--
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, 
password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) 
NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/mysql/01-expected-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/mysql/01-expected-init.sql
new file mode 100644
index 00000000000..94097717509
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/mysql/01-expected-init.sql
@@ -0,0 +1,24 @@
+--
+-- 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.
+--
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS expected_dataset;
+CREATE DATABASE expected_dataset;
+
+CREATE TABLE expected_dataset.t_user (user_id INT PRIMARY KEY, user_name 
VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT 
NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/opengauss/01-expected-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/opengauss/01-expected-init.sql
new file mode 100644
index 00000000000..0ee0a77b33d
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/opengauss/01-expected-init.sql
@@ -0,0 +1,27 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS expected_dataset;
+CREATE DATABASE expected_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE expected_dataset TO test_user;
+
+\c expected_dataset;
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, 
password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) 
NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/oracle/01-expected-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/oracle/01-expected-init.sql
new file mode 100644
index 00000000000..15ffd3ab47a
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/oracle/01-expected-init.sql
@@ -0,0 +1,21 @@
+--
+-- 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.
+--
+
+DROP SCHEMA expected_dataset;
+CREATE SCHEMA expected_dataset;
+
+CREATE TABLE expected_dataset.t_user (user_id INT PRIMARY KEY, user_name 
VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT 
NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/postgresql/01-expected-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/postgresql/01-expected-init.sql
new file mode 100644
index 00000000000..0ee0a77b33d
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/postgresql/01-expected-init.sql
@@ -0,0 +1,27 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS expected_dataset;
+CREATE DATABASE expected_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE expected_dataset TO test_user;
+
+\c expected_dataset;
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, 
password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) 
NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/sqlserver/01-expected-init.sql
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/sqlserver/01-expected-init.sql
new file mode 100644
index 00000000000..8cbad8ae180
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/data/expected/init-sql/sqlserver/01-expected-init.sql
@@ -0,0 +1,22 @@
+--
+-- 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.
+--
+
+DROP DATABASE IF EXISTS expected_dataset;
+
+CREATE DATABASE expected_dataset;
+
+CREATE TABLE expected_dataset.t_user (user_id INT PRIMARY KEY, user_name 
VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT 
NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/mysql/config-mask-encrypt.yaml
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/mysql/config-mask-encrypt.yaml
new file mode 100644
index 00000000000..19c2e1903d0
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/mysql/config-mask-encrypt.yaml
@@ -0,0 +1,78 @@
+#
+# 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.
+#
+
+databaseName: mask_encrypt
+
+dataSources:
+  mask_encrypt:
+    url: 
jdbc:mysql://mysql.mask_encrypt.host:3306/mask_encrypt?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/opengauss/config-mask-encrypt.yaml
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/opengauss/config-mask-encrypt.yaml
new file mode 100644
index 00000000000..f3bc9ffa2a4
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/opengauss/config-mask-encrypt.yaml
@@ -0,0 +1,78 @@
+#
+# 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.
+#
+
+databaseName: mask_encrypt
+
+dataSources:
+  mask_encrypt:
+    url: jdbc:opengauss://opengauss.mask_encrypt.host:5432/mask_encrypt
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/postgresql/config-mask-encrypt.yaml
 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/postgresql/config-mask-encrypt.yaml
new file mode 100644
index 00000000000..6773d17bd75
--- /dev/null
+++ 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/proxy/conf/postgresql/config-mask-encrypt.yaml
@@ -0,0 +1,78 @@
+#
+# 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.
+#
+
+databaseName: mask_encrypt
+
+dataSources:
+  mask_encrypt:
+    url: jdbc:postgresql://postgresql.mask_encrypt.host:5432/mask_encrypt
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor
diff --git 
a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/rules.yaml 
b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/rules.yaml
new file mode 100644
index 00000000000..e252c4043bb
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt/rules.yaml
@@ -0,0 +1,65 @@
+#
+# 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.
+#
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor

Reply via email to