You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/02/09 02:37:33 UTC
[shardingsphere] branch master updated: splitting rdl-integration-test-cases.xml file (#24062)
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 36d20ffcf12 splitting rdl-integration-test-cases.xml file (#24062)
36d20ffcf12 is described below
commit 36d20ffcf1266b766440c4378188a3cfd41dda18
Author: gxxiong <xi...@foxmail.com>
AuthorDate: Thu Feb 9 10:37:23 2023 +0800
splitting rdl-integration-test-cases.xml file (#24062)
---
.../resources/cases/rdl/rdl-integration-alter.xml | 69 ++++++++
.../resources/cases/rdl/rdl-integration-create.xml | 84 ++++++++++
.../resources/cases/rdl/rdl-integration-drop.xml | 59 +++++++
.../cases/rdl/rdl-integration-register.xml | 25 +++
.../resources/cases/rdl/rdl-integration-set.xml | 27 ++++
.../cases/rdl/rdl-integration-test-cases.xml | 180 ---------------------
.../cases/rdl/rdl-integration-unregister.xml | 24 +++
7 files changed, 288 insertions(+), 180 deletions(-)
diff --git a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-alter.xml b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-alter.xml
new file mode 100644
index 00000000000..3c79380575a
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-alter.xml
@@ -0,0 +1,69 @@
+<!--
+ ~ 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.
+ -->
+<integration-test-cases>
+ <!-- TODO FIX HOST CANNOT CONNECT -->
+ <!-- <test-case sql="ALTER STORAGE UNIT ds_2 (URL='jdbc:mysql://mysql.rdl.empty_rules.host:3306/rdl_ds_2?serverTimezone=UTC&useSSL=false', USER='test_user',PASSWORD='Test@123',PROPERTIES('idleTimeout'='30000'));" db-types="MySQL">-->
+ <!-- <assertion expected-data-file="alter_storage_unit.xml">-->
+ <!-- <assertion-sql sql="SHOW DATABASE RESOURCES" />-->
+ <!-- </assertion>-->
+ <!-- </test-case>-->
+
+ <test-case sql="ALTER SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item)" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="alter_binding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));
+ CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 2}')))));
+ CREATE SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item);" />
+ <assertion-sql sql="SHOW SHARDING TABLE REFERENCE RULES;" />
+ <destroy-sql sql="DROP SHARDING TABLE REFERENCE RULE reference_0;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="ALTER ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abcd'))))),QUERY_WITH_CIPHER_COLUMN=true);" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="alter_encrypt_rule.xml">
+ <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" />
+ <assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
+ <destroy-sql sql="DROP ENCRYPT RULE t_user " />
+ </assertion>
+ </test-case>
+
+ <test-case sql="ALTER SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));" db-types="MySQL">
+ <assertion expected-data-file="alter_sharding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
+ <assertion-sql sql="SHOW SHARDING TABLE RULES;" />
+ <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
+ </assertion>
+ <assertion expected-data-file="alter_sharding_rules_show_tables.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
+ <assertion-sql sql="SHOW TABLES;" />
+ <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="ALTER READWRITE_SPLITTING RULE readwrite_ds (WRITE_STORAGE_UNIT=ds_0,READ_STORAGE_UNITS(ds_0),TYPE(NAME='RANDOM'));" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="alter_readwrite_splitting_rules.xml">
+ <assertion-sql sql="SHOW READWRITE_SPLITTING RULES;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="ALTER MASK RULE t_mask (COLUMNS((NAME=order_id, TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES('from-x'=1, 'to-y'=2, 'replace-char'='*'))))));">
+ <assertion expected-data-file="alter_mask_rule.xml">
+ <initial-sql sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));" />
+ <assertion-sql sql="SHOW MASK RULES;" />
+ <destroy-sql sql="DROP MASK RULE t_mask;" />
+ </assertion>
+ </test-case>
+</integration-test-cases>
diff --git a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-create.xml b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-create.xml
new file mode 100644
index 00000000000..0c3c645cae5
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-create.xml
@@ -0,0 +1,84 @@
+<!--
+ ~ 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.
+ -->
+<integration-test-cases>
+ <test-case sql="CREATE SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item);" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="create_binding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));
+ CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 2}')))));" />
+ <assertion-sql sql="SHOW SHARDING TABLE REFERENCE RULES;" />
+ <destroy-sql sql="DROP SHARDING TABLE REFERENCE RULE reference_0;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="CREATE BROADCAST TABLE RULE t_product_category;" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="create_broadcast_rules.xml">
+ <assertion-sql sql="SHOW BROADCAST TABLE RULES;" />
+ <destroy-sql sql="DROP BROADCAST TABLE RULE t_product_category; " />
+ </assertion>
+ </test-case>
+
+ <test-case sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="create_encrypt_rule.xml">
+ <assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
+ <destroy-sql sql="DROP ENCRYPT RULE t_user " />
+ </assertion>
+ </test-case>
+
+ <test-case sql="CREATE TABLE temp (country_id INT PRIMARY KEY, country_name VARCHAR(50), continent_name VARCHAR(50), creation_date DATE NOT NULL);" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="create_single_table_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));
+ CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 4}')))));
+ SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_1;" />
+ <assertion-sql sql="SHOW SINGLE TABLES;" />
+ <destroy-sql sql="DROP TABLE temp;SET DEFAULT SINGLE TABLE STORAGE UNIT = RANDOM;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="CREATE TABLE temp_alter (country_id INT PRIMARY KEY, country_name VARCHAR(50), continent_name VARCHAR(50), creation_date DATE NOT NULL);" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="alter_single_table_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));
+ CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 4}')))));
+ SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_1;SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_0;" />
+ <assertion-sql sql="SHOW SINGLE TABLES;" />
+ <destroy-sql sql="DROP TABLE temp_alter;SET DEFAULT SINGLE TABLE STORAGE UNIT = RANDOM;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" db-types="MySQL">
+ <assertion expected-data-file="create_sharding_rules.xml">
+ <assertion-sql sql="SHOW SHARDING TABLE RULES;" />
+ <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
+ </assertion>
+ <assertion expected-data-file="create_sharding_rules_show_tables.xml">
+ <assertion-sql sql="SHOW TABLES;" />
+ <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="CREATE READWRITE_SPLITTING RULE readwrite_ds (WRITE_STORAGE_UNIT=ds_0,READ_STORAGE_UNITS(ds_1),TYPE(NAME='RANDOM'));" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="create_readwrite_splitting_rules.xml">
+ <assertion-sql sql="SHOW READWRITE_SPLITTING RULES;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));">
+ <assertion expected-data-file="create_mask_rule.xml">
+ <assertion-sql sql="SHOW MASK RULES;" />
+ <destroy-sql sql="DROP MASK RULE t_mask;" />
+ </assertion>
+ </test-case>
+</integration-test-cases>
diff --git a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-drop.xml b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-drop.xml
new file mode 100644
index 00000000000..732f9dff644
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-drop.xml
@@ -0,0 +1,59 @@
+<!--
+ ~ 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.
+ -->
+<integration-test-cases>
+ <test-case sql="DROP SHARDING TABLE REFERENCE RULE reference_0;" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="drop_binding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));
+ CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 2}')))));
+ CREATE SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item);" />
+ <assertion-sql sql="SHOW SHARDING TABLE REFERENCE RULES;" />
+ <destroy-sql sql="DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="DROP BROADCAST TABLE RULE t_country;" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="drop_broadcast_rules.xml">
+ <initial-sql sql="CREATE BROADCAST TABLE RULE t_country;" />
+ <assertion-sql sql="SHOW BROADCAST TABLE RULES;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="DROP ENCRYPT RULE t_user;" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="drop_encrypt_rule.xml">
+ <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" />
+ <assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="DROP SHARDING TABLE RULE t_order" db-types="MySQL">
+ <assertion expected-data-file="drop_sharding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
+ <assertion-sql sql="SHOW SHARDING TABLE RULES;" />
+ </assertion>
+ <assertion expected-data-file="drop_sharding_rules_show_tables.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
+ <assertion-sql sql="SHOW TABLES;" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="DROP MASK RULE t_mask;">
+ <assertion expected-data-file="drop_mask_rule.xml">
+ <initial-sql sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));" />
+ <assertion-sql sql="SHOW MASK RULES;" />
+ </assertion>
+ </test-case>
+</integration-test-cases>
diff --git a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-register.xml b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-register.xml
new file mode 100644
index 00000000000..1f3d6fc76a6
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-register.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ 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.
+ -->
+<integration-test-cases>
+ <!-- TODO FIX HOST CANNOT CONNECT -->
+ <!-- <test-case sql="REGISTER STORAGE UNIT ds_0 (URL='jdbc:mysql://mysql.rdl.empty_rules.host:3306/rdl_ds_0?serverTimezone=UTC&useSSL=false', USER='test_user',PASSWORD='Test@123');" db-types="MySQL">-->
+ <!-- <assertion expected-data-file="register_storage_unit.xml">-->
+ <!-- <assertion-sql sql="SHOW DATABASE RESOURCES" />-->
+ <!-- </assertion>-->
+ <!-- </test-case>-->
+
+</integration-test-cases>
diff --git a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-set.xml b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-set.xml
new file mode 100644
index 00000000000..5d1e41189d8
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-set.xml
@@ -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.
+ -->
+<integration-test-cases>
+ <test-case sql="SET DEFAULT SINGLE TABLE STORAGE UNIT = RANDOM" db-types="MySQL, PostgreSQL">
+ <assertion expected-data-file="drop_single_table_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));
+ CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 4}')))));
+ SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_0;" />
+ <assertion-sql sql="SHOW SINGLE TABLES;" />
+ <destroy-sql sql="DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
+ </assertion>
+ </test-case>
+</integration-test-cases>
diff --git a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
deleted file mode 100644
index 2787a4da2fb..00000000000
--- a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
+++ /dev/null
@@ -1,180 +0,0 @@
-<!--
- ~ 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.
- -->
-<integration-test-cases>
- <!-- TODO FIX HOST CANNOT CONNECT -->
-<!-- <test-case sql="REGISTER STORAGE UNIT ds_0 (URL='jdbc:mysql://mysql.rdl.empty_rules.host:3306/rdl_ds_0?serverTimezone=UTC&useSSL=false', USER='test_user',PASSWORD='Test@123');" db-types="MySQL">-->
-<!-- <assertion expected-data-file="register_storage_unit.xml">-->
-<!-- <assertion-sql sql="SHOW DATABASE RESOURCES" />-->
-<!-- </assertion>-->
-<!-- </test-case>-->
-<!-- <test-case sql="ALTER STORAGE UNIT ds_2 (URL='jdbc:mysql://mysql.rdl.empty_rules.host:3306/rdl_ds_2?serverTimezone=UTC&useSSL=false', USER='test_user',PASSWORD='Test@123',PROPERTIES('idleTimeout'='30000'));" db-types="MySQL">-->
-<!-- <assertion expected-data-file="alter_storage_unit.xml">-->
-<!-- <assertion-sql sql="SHOW DATABASE RESOURCES" />-->
-<!-- </assertion>-->
-<!-- </test-case>-->
-<!-- <test-case sql="UNREGISTER STORAGE UNIT ds_2;" db-types="MySQL, PostgreSQL">-->
-<!-- <assertion expected-data-file="unregister_storage_unit.xml">-->
-<!-- <assertion-sql sql="SHOW DATABASE RESOURCES" />-->
-<!-- </assertion>-->
-<!-- </test-case>-->
- <test-case sql="CREATE SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item);" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="create_binding_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));
- CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 2}')))));" />
- <assertion-sql sql="SHOW SHARDING TABLE REFERENCE RULES;" />
- <destroy-sql sql="DROP SHARDING TABLE REFERENCE RULE reference_0;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
- </assertion>
- </test-case>
- <test-case sql="ALTER SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item)" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="alter_binding_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));
- CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 2}')))));
- CREATE SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item);" />
- <assertion-sql sql="SHOW SHARDING TABLE REFERENCE RULES;" />
- <destroy-sql sql="DROP SHARDING TABLE REFERENCE RULE reference_0;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
- </assertion>
- </test-case>
- <test-case sql="DROP SHARDING TABLE REFERENCE RULE reference_0;" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="drop_binding_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));
- CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 2}')))));
- CREATE SHARDING TABLE REFERENCE RULE reference_0 (t_order,t_order_item);" />
- <assertion-sql sql="SHOW SHARDING TABLE REFERENCE RULES;" />
- <destroy-sql sql="DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
- </assertion>
- </test-case>
- <test-case sql="CREATE BROADCAST TABLE RULE t_product_category;" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="create_broadcast_rules.xml">
- <assertion-sql sql="SHOW BROADCAST TABLE RULES;" />
- <destroy-sql sql="DROP BROADCAST TABLE RULE t_product_category; " />
- </assertion>
- </test-case>
- <test-case sql="DROP BROADCAST TABLE RULE t_country;" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="drop_broadcast_rules.xml">
- <initial-sql sql="CREATE BROADCAST TABLE RULE t_country;" />
- <assertion-sql sql="SHOW BROADCAST TABLE RULES;" />
- </assertion>
- </test-case>
- <test-case sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="create_encrypt_rule.xml">
- <assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
- <destroy-sql sql="DROP ENCRYPT RULE t_user " />
- </assertion>
- </test-case>
- <test-case sql="ALTER ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abcd'))))),QUERY_WITH_CIPHER_COLUMN=true);" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="alter_encrypt_rule.xml">
- <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" />
- <assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
- <destroy-sql sql="DROP ENCRYPT RULE t_user " />
- </assertion>
- </test-case>
- <test-case sql="DROP ENCRYPT RULE t_user;" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="drop_encrypt_rule.xml">
- <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" />
- <assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
- </assertion>
- </test-case>
- <test-case sql="CREATE TABLE temp (country_id INT PRIMARY KEY, country_name VARCHAR(50), continent_name VARCHAR(50), creation_date DATE NOT NULL);" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="create_single_table_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));
- CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 4}')))));
- SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_1;" />
- <assertion-sql sql="SHOW SINGLE TABLES;" />
- <destroy-sql sql="DROP TABLE temp;SET DEFAULT SINGLE TABLE STORAGE UNIT = RANDOM;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
- </assertion>
- </test-case>
- <test-case sql="CREATE TABLE temp_alter (country_id INT PRIMARY KEY, country_name VARCHAR(50), continent_name VARCHAR(50), creation_date DATE NOT NULL);" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="alter_single_table_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));
- CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 4}')))));
- SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_1;SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_0;" />
- <assertion-sql sql="SHOW SINGLE TABLES;" />
- <destroy-sql sql="DROP TABLE temp_alter;SET DEFAULT SINGLE TABLE STORAGE UNIT = RANDOM;DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
- </assertion>
- </test-case>
- <test-case sql="SET DEFAULT SINGLE TABLE STORAGE UNIT = RANDOM" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="drop_single_table_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));
- CREATE SHARDING TABLE RULE t_order_item (DATANODES('ds_2.t_order_item_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_item_${order_id % 4}')))));
- SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_0;" />
- <assertion-sql sql="SHOW SINGLE TABLES;" />
- <destroy-sql sql="DROP SHARDING TABLE RULE t_order;DROP SHARDING TABLE RULE t_order_item;" />
- </assertion>
- </test-case>
- <test-case sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" db-types="MySQL">
- <assertion expected-data-file="create_sharding_rules.xml">
- <assertion-sql sql="SHOW SHARDING TABLE RULES;" />
- <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
- </assertion>
- <assertion expected-data-file="create_sharding_rules_show_tables.xml">
- <assertion-sql sql="SHOW TABLES;" />
- <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
- </assertion>
- </test-case>
- <test-case sql="ALTER SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..3}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 4}')))));" db-types="MySQL">
- <assertion expected-data-file="alter_sharding_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
- <assertion-sql sql="SHOW SHARDING TABLE RULES;" />
- <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
- </assertion>
- <assertion expected-data-file="alter_sharding_rules_show_tables.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
- <assertion-sql sql="SHOW TABLES;" />
- <destroy-sql sql="DROP SHARDING TABLE RULE t_order" />
- </assertion>
- </test-case>
- <test-case sql="DROP SHARDING TABLE RULE t_order" db-types="MySQL">
- <assertion expected-data-file="drop_sharding_rules.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
- <assertion-sql sql="SHOW SHARDING TABLE RULES;" />
- </assertion>
- <assertion expected-data-file="drop_sharding_rules_show_tables.xml">
- <initial-sql sql="CREATE SHARDING TABLE RULE t_order (DATANODES('ds_2.t_order_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_order_${order_id % 2}')))));" />
- <assertion-sql sql="SHOW TABLES;" />
- </assertion>
- </test-case>
- <test-case sql="CREATE READWRITE_SPLITTING RULE readwrite_ds (WRITE_STORAGE_UNIT=ds_0,READ_STORAGE_UNITS(ds_1),TYPE(NAME='RANDOM'));" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="create_readwrite_splitting_rules.xml">
- <assertion-sql sql="SHOW READWRITE_SPLITTING RULES;" />
- </assertion>
- </test-case>
- <test-case sql="ALTER READWRITE_SPLITTING RULE readwrite_ds (WRITE_STORAGE_UNIT=ds_0,READ_STORAGE_UNITS(ds_0),TYPE(NAME='RANDOM'));" db-types="MySQL, PostgreSQL">
- <assertion expected-data-file="alter_readwrite_splitting_rules.xml">
- <assertion-sql sql="SHOW READWRITE_SPLITTING RULES;" />
- </assertion>
- </test-case>
- <test-case sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));">
- <assertion expected-data-file="create_mask_rule.xml">
- <assertion-sql sql="SHOW MASK RULES;" />
- <destroy-sql sql="DROP MASK RULE t_mask;" />
- </assertion>
- </test-case>
- <test-case sql="ALTER MASK RULE t_mask (COLUMNS((NAME=order_id, TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES('from-x'=1, 'to-y'=2, 'replace-char'='*'))))));">
- <assertion expected-data-file="alter_mask_rule.xml">
- <initial-sql sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));" />
- <assertion-sql sql="SHOW MASK RULES;" />
- <destroy-sql sql="DROP MASK RULE t_mask;" />
- </assertion>
- </test-case>
- <test-case sql="DROP MASK RULE t_mask;">
- <assertion expected-data-file="drop_mask_rule.xml">
- <initial-sql sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));" />
- <assertion-sql sql="SHOW MASK RULES;" />
- </assertion>
- </test-case>
-</integration-test-cases>
-
diff --git a/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-unregister.xml b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-unregister.xml
new file mode 100644
index 00000000000..88fe656f07d
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/cases/rdl/rdl-integration-unregister.xml
@@ -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.
+ -->
+<integration-test-cases>
+ <!-- TODO FIX HOST CANNOT CONNECT -->
+ <!-- <test-case sql="UNREGISTER STORAGE UNIT ds_2;" db-types="MySQL, PostgreSQL">-->
+ <!-- <assertion expected-data-file="unregister_storage_unit.xml">-->
+ <!-- <assertion-sql sql="SHOW DATABASE RESOURCES" />-->
+ <!-- </assertion>-->
+ <!-- </test-case>-->
+</integration-test-cases>