You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/09/25 05:08:42 UTC
[shardingsphere] branch master updated: add rdl cases and open
tests (#12679)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 eb7d92d add rdl cases and open tests (#12679)
eb7d92d is described below
commit eb7d92d771f4ec893514c4a2542a505328155149
Author: Jieker <ji...@163.com>
AuthorDate: Sat Sep 25 13:07:46 2021 +0800
add rdl cases and open tests (#12679)
* add rdl cases
* add item rules
* add rdl cases and open tests
* add new line
---
.github/workflows/it.yml | 2 +-
.../test/integration/engine/it/rdl/BaseRDLIT.java | 7 +-
.../empty_rules/mysql/alter_binding_rules.xml | 23 ++++
.../empty_rules/mysql/alter_encrypt_rule.xml | 28 +++++
.../mysql/alter_readwrite_splitting_rules.xml | 29 +++++
.../empty_rules/mysql/create_binding_rules.xml | 23 ++++
.../empty_rules/mysql/create_broadcast_rules.xml | 23 ++++
.../empty_rules/mysql/create_encrypt_rule.xml | 28 +++++
.../mysql/create_readwrite_splitting_rules.xml | 29 +++++
.../empty_rules/mysql/create_sharding_rules.xml | 36 ++++++
.../empty_rules/mysql/drop_binding_rules.xml | 22 ++++
.../empty_rules/mysql/drop_broadcast_rules.xml | 22 ++++
.../empty_rules/mysql/drop_encrypt_rule.xml | 27 +++++
.../mysql/drop_readwrite_splitting_rules.xml | 27 +++++
.../empty_rules/mysql/drop_sharding_rules.xml | 35 ++++++
.../cases/rdl/rdl-integration-test-cases.xml | 123 ++++++++++++++++++++-
.../cases/rql/rql-integration-test-cases.xml | 20 ++--
.../mysql/proxy/conf/config-empty-rules.yaml | 34 ++++++
18 files changed, 522 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml
index 3db047c..4813617 100644
--- a/.github/workflows/it.yml
+++ b/.github/workflows/it.yml
@@ -37,7 +37,7 @@ jobs:
env: [ docker ]
adapter: [ proxy, jdbc ]
database: [ MySQL ]
- scenario: [ db,tbl,dbtbl_with_readwrite_splitting,encrypt,dbtbl_with_readwrite_splitting_and_encrypt,readwrite_splitting ]
+ scenario: [ db,tbl,dbtbl_with_readwrite_splitting,encrypt,dbtbl_with_readwrite_splitting_and_encrypt,readwrite_splitting,empty_rules ]
steps:
- name: Cache Maven Repos
uses: actions/cache@v2
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/rdl/BaseRDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/rdl/BaseRDLIT.java
index 66553b7..1de016e 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/rdl/BaseRDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/rdl/BaseRDLIT.java
@@ -54,9 +54,10 @@ public abstract class BaseRDLIT extends SingleITCase {
@Override
public final void tearDown() throws Exception {
- assertNotNull("Destroy SQL is required", getAssertion().getDestroySQL());
- try (Connection connection = getTargetDataSource().getConnection()) {
- executeDestroySQLs(connection);
+ if (getAssertion().getDestroySQL() != null) {
+ try (Connection connection = getTargetDataSource().getConnection()) {
+ executeDestroySQLs(connection);
+ }
}
super.tearDown();
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_binding_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_binding_rules.xml
new file mode 100644
index 0000000..f3a5003
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_binding_rules.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ 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>
+ <column name="sharding_binding_tables" />
+ </metadata>
+ <row values="t_user,t_user_item" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_encrypt_rule.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_encrypt_rule.xml
new file mode 100644
index 0000000..5964923
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_encrypt_rule.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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>
+ <column name="table" />
+ <column name="logic_column" />
+ <column name="cipher_column" />
+ <column name="plain_column" />
+ <column name="encryptor_type" />
+ <column name="encryptor_props" />
+ </metadata>
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| AES| aes-key-value=123abc" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_readwrite_splitting_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_readwrite_splitting_rules.xml
new file mode 100644
index 0000000..8de1b01
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/alter_readwrite_splitting_rules.xml
@@ -0,0 +1,29 @@
+<!--
+ ~ 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>
+ <column name="name" />
+ <column name="auto_aware_data_source_name" />
+ <column name="write_data_source_name" />
+ <column name="read_data_source_names" />
+ <column name="load_balancer_type" />
+ <column name="load_balancer_props" />
+ </metadata>
+ <row values="pr_ds_0| null| encrypt_write_ds_0| encrypt_read_ds_0| ROUND_ROBIN| " />
+ <row values="pr_ds_1| null| encrypt_write_ds_1| encrypt_read_ds_1,encrypt_read_ds_2| RANDOM| read_weight='2:1'" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_binding_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_binding_rules.xml
new file mode 100644
index 0000000..f3a5003
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_binding_rules.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ 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>
+ <column name="sharding_binding_tables" />
+ </metadata>
+ <row values="t_user,t_user_item" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_broadcast_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_broadcast_rules.xml
new file mode 100644
index 0000000..d527d31
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_broadcast_rules.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ 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>
+ <column name="sharding_broadcast_tables" />
+ </metadata>
+ <row values="t_broadcast_table" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_encrypt_rule.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_encrypt_rule.xml
new file mode 100644
index 0000000..fe97e0a
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_encrypt_rule.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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>
+ <column name="table" />
+ <column name="logic_column" />
+ <column name="cipher_column" />
+ <column name="plain_column" />
+ <column name="encryptor_type" />
+ <column name="encryptor_props" />
+ </metadata>
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| AES| aes-key-value=123456abc" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_readwrite_splitting_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_readwrite_splitting_rules.xml
new file mode 100644
index 0000000..94b0452
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_readwrite_splitting_rules.xml
@@ -0,0 +1,29 @@
+<!--
+ ~ 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>
+ <column name="name" />
+ <column name="auto_aware_data_source_name" />
+ <column name="write_data_source_name" />
+ <column name="read_data_source_names" />
+ <column name="load_balancer_type" />
+ <column name="load_balancer_props" />
+ </metadata>
+ <row values="pr_ds_0| null| encrypt_write_ds_0| encrypt_read_ds_0| ROUND_ROBIN| " />
+ <row values="pr_ds_1| null| encrypt_write_ds_1| encrypt_read_ds_1| ROUND_ROBIN| " />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_sharding_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_sharding_rules.xml
new file mode 100644
index 0000000..f2f278a
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/create_sharding_rules.xml
@@ -0,0 +1,36 @@
+<!--
+ ~ 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>
+ <column name="table" />
+ <column name="actual_data_nodes" />
+ <column name="actual_data_sources" />
+ <column name="database_strategy_type" />
+ <column name="database_sharding_column" />
+ <column name="database_sharding_algorithm_type" />
+ <column name="database_sharding_algorithm_props" />
+ <column name="table_strategy_type" />
+ <column name="table_sharding_column" />
+ <column name="table_sharding_algorithm_type" />
+ <column name="table_sharding_algorithm_props" />
+ <column name="key_generate_column" />
+ <column name="key_generator_type" />
+ <column name="key_generator_props" />
+ </metadata>
+ <row values="t_user| | encrypt_write_ds_${0..9}| | | | | MOD| user_id| MOD| sharding-count=40| | | " />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_binding_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_binding_rules.xml
new file mode 100644
index 0000000..649c170
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_binding_rules.xml
@@ -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.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="sharding_binding_tables" />
+ </metadata>
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_broadcast_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_broadcast_rules.xml
new file mode 100644
index 0000000..53ecd54
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_broadcast_rules.xml
@@ -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.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="sharding_broadcast_tables" />
+ </metadata>
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_encrypt_rule.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_encrypt_rule.xml
new file mode 100644
index 0000000..d28df47
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_encrypt_rule.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.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="table" />
+ <column name="logic_column" />
+ <column name="cipher_column" />
+ <column name="plain_column" />
+ <column name="encryptor_type" />
+ <column name="encryptor_props" />
+ </metadata>
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_readwrite_splitting_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_readwrite_splitting_rules.xml
new file mode 100644
index 0000000..3b42aa8
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_readwrite_splitting_rules.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.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="name" />
+ <column name="auto_aware_data_source_name" />
+ <column name="write_data_source_name" />
+ <column name="read_data_source_names" />
+ <column name="load_balancer_type" />
+ <column name="load_balancer_props" />
+ </metadata>
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_sharding_rules.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_sharding_rules.xml
new file mode 100644
index 0000000..ec887a6
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/dataset/empty_rules/mysql/drop_sharding_rules.xml
@@ -0,0 +1,35 @@
+<!--
+ ~ 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>
+ <column name="table" />
+ <column name="actual_data_nodes" />
+ <column name="actual_data_sources" />
+ <column name="database_strategy_type" />
+ <column name="database_sharding_column" />
+ <column name="database_sharding_algorithm_type" />
+ <column name="database_sharding_algorithm_props" />
+ <column name="table_strategy_type" />
+ <column name="table_sharding_column" />
+ <column name="table_sharding_algorithm_type" />
+ <column name="table_sharding_algorithm_props" />
+ <column name="key_generate_column" />
+ <column name="key_generator_type" />
+ <column name="key_generator_props" />
+ </metadata>
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
index 844f8c2..43c960d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
@@ -24,7 +24,7 @@
PROPERTIES("maxPoolSize"=2,"maxPoolSize"=2,"connectionTimeoutMilliseconds"=30000,"idleTimeoutMilliseconds"=60000,"maxLifetimeMilliseconds"=1800000));" />
</assertion>
</test-case>
-
+
<test-case sql="SHOW RESOURCES">
<assertion expected-data-file="drop_resource.xml">
<initial-sql sql="DROP RESOURCE rdl_test_0;"/>
@@ -32,7 +32,7 @@
PROPERTIES("maxPoolSize"=2,"maxPoolSize"=2,"connectionTimeoutMilliseconds"=30000,"idleTimeoutMilliseconds"=60000,"maxLifetimeMilliseconds"=1800000));" />
</assertion>
</test-case>
-
+
<!--FIXME! IP CANNOT CONNECT-->
<test-case sql="SHOW RESOURCES" db-types="PostgreSQL">
<assertion expected-data-file="add_resource.xml">
@@ -44,4 +44,123 @@
<destroy-sql sql="DROP RESOURCE rdl_test_1, rdl_test_2;" />
</assertion>
</test-case>
+
+ <test-case sql="SHOW SHARDING TABLE RULE t_user">
+ <assertion expected-data-file="create_sharding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_user (
+ RESOURCES("encrypt_write_ds_${0..9}"),
+ SHARDING_COLUMN=user_id, TYPE(NAME=MOD, PROPERTIES("sharding-count"=40)))))"/>
+ <destroy-sql sql="DROP SHARDING TABLE RULE t_user" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW SHARDING TABLE RULE t_user_item">
+ <assertion expected-data-file="drop_sharding_rules.xml">
+ <initial-sql sql="DROP SHARDING TABLE RULE t_user_item"/>
+ <destroy-sql sql="CREATE SHARDING TABLE RULE t_user_item (
+ RESOURCES("encrypt_write_ds_${0..9}"),
+ SHARDING_COLUMN=user_id, TYPE(NAME=MOD, PROPERTIES("sharding-count"=40)))))" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW SHARDING BINDING TABLE RULES">
+ <assertion expected-data-file="create_binding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_user (
+ RESOURCES("encrypt_write_ds_${0..9}"),
+ SHARDING_COLUMN=user_id, TYPE(NAME=MOD, PROPERTIES("sharding-count"=40)))));
+ CREATE SHARDING BINDING TABLE RULES ((t_user,t_user_item))"/>
+ <destroy-sql sql="DROP SHARDING BINDING TABLE RULES;DROP SHARDING TABLE RULE t_user" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW SHARDING BINDING TABLE RULES">
+ <assertion expected-data-file="alter_binding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_user (
+ RESOURCES("encrypt_write_ds_${0..9}"),
+ SHARDING_COLUMN=user_id, TYPE(NAME=MOD, PROPERTIES("sharding-count"=40)))));
+ ALTER SHARDING BINDING TABLE RULES ((t_user,t_user_item));"/>
+ <destroy-sql sql="DROP SHARDING BINDING TABLE RULES;DROP SHARDING TABLE RULE t_user" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW SHARDING BINDING TABLE RULES">
+ <assertion expected-data-file="drop_binding_rules.xml">
+ <initial-sql sql="CREATE SHARDING TABLE RULE t_user (
+ RESOURCES("encrypt_write_ds_${0..9}"),
+ SHARDING_COLUMN=user_id, TYPE(NAME=MOD, PROPERTIES("sharding-count"=40)))));
+ CREATE SHARDING BINDING TABLE RULES ((t_user,t_user_item));
+ DROP SHARDING BINDING TABLE RULES;DROP SHARDING TABLE RULE t_user"/>
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW SHARDING BROADCAST TABLE RULES">
+ <assertion expected-data-file="create_broadcast_rules.xml">
+ <initial-sql sql="CREATE SHARDING BROADCAST TABLE RULES (t_broadcast_table)"/>
+ <destroy-sql sql="DROP SHARDING BROADCAST TABLE RULES" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW SHARDING BROADCAST TABLE RULES">
+ <assertion expected-data-file="drop_broadcast_rules.xml">
+ <initial-sql sql="CREATE SHARDING BROADCAST TABLE RULES (t_broadcast_table);
+ DROP SHARDING BROADCAST TABLE RULES"/>
+ </assertion>
+ </test-case>
+
+ <!--FIXME encrypt rdl cannot run-->
+ <test-case sql="SHOW ENCRYPT TABLE RULE t_user" db-types="PostgreSQL">
+ <assertion expected-data-file="create_encrypt_rule.xml">
+ <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS (
+ NAME=pwd, PLAIN=pwd_plain, CIPHER=pwd_cipher), TYPE(NAME=AES,
+ PROPERTIES("aes-key-value"="123456abc"))))"/>
+ <destroy-sql sql="DROP ENCRYPT RULE t_user" />
+ </assertion>
+ </test-case>
+
+ <!--FIXME encrypt rdl cannot run-->
+ <test-case sql="SHOW ENCRYPT TABLE RULE t_user" db-types="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), TYPE(NAME=AES, PROPERTIES("aes-key-value"="123456abc"))));
+ ALTER ENCRYPT RULE t_user (COLUMNS (NAME=pwd, PLAIN=pwd_plain, CIPHER=pwd_cipher), TYPE(NAME=AES,
+ PROPERTIES("aes-key-value"="123abc"))))"/>
+ <destroy-sql sql="DROP ENCRYPT RULE t_user" />
+ </assertion>
+ </test-case>
+
+ <!--FIXME encrypt rdl cannot run-->
+ <test-case sql="SHOW ENCRYPT TABLE RULES" db-types="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),
+ TYPE(NAME=AES, PROPERTIES("aes-key-value"="123456abc"))));
+ DROP ENCRYPT RULE t_user"/>
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW READWRITE_SPLITTING RULES">
+ <assertion expected-data-file="create_readwrite_splitting_rules.xml">
+ <initial-sql sql="CREATE READWRITE_SPLITTING RULE pr_ds_1 (WRITE_RESOURCE=encrypt_write_ds_1,
+ READ_RESOURCES(encrypt_read_ds_1), TYPE(NAME=ROUND_ROBIN))"/>
+ <destroy-sql sql="DROP READWRITE_SPLITTING RULE pr_ds_1" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW READWRITE_SPLITTING RULES">
+ <assertion expected-data-file="alter_readwrite_splitting_rules.xml">
+ <initial-sql sql="CREATE READWRITE_SPLITTING RULE pr_ds_1 (WRITE_RESOURCE=encrypt_write_ds_1,
+ READ_RESOURCES(encrypt_read_ds_1), TYPE(NAME=ROUND_ROBIN));
+ ALTER READWRITE_SPLITTING RULE pr_ds_1 (WRITE_RESOURCE=encrypt_write_ds_1,
+ READ_RESOURCES(encrypt_read_ds_1, encrypt_read_ds_2), TYPE(NAME=RANDOM,PROPERTIES(read_weight='2:1')))"/>
+ <destroy-sql sql="DROP READWRITE_SPLITTING RULE pr_ds_1" />
+ </assertion>
+ </test-case>
+
+ <test-case sql="SHOW READWRITE_SPLITTING RULES">
+ <assertion expected-data-file="drop_readwrite_splitting_rules.xml">
+ <initial-sql sql="DROP READWRITE_SPLITTING RULE pr_ds_0"/>
+ </assertion>
+ </test-case>
+
+ <!--TODO add db discovery tests-->
</integration-test-cases>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rql/rql-integration-test-cases.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rql/rql-integration-test-cases.xml
index bb49187..597551b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rql/rql-integration-test-cases.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rql/rql-integration-test-cases.xml
@@ -18,43 +18,43 @@
<test-case sql="SHOW RESOURCES">
<assertion expected-data-file="show_resources.xml" />
</test-case>
-
+
<test-case sql="SHOW SHARDING TABLE RULES">
<assertion expected-data-file="show_rules.xml" />
</test-case>
-
+
<test-case sql="SHOW SHARDING TABLE RULE t_order" scenario-types="db,tbl,dbtbl_with_readwrite_splitting,readwrite_splitting,sharding_governance">
<assertion expected-data-file="show_table_rule.xml" />
</test-case>
-
+
<test-case sql="SHOW SHARDING TABLE RULE t_user" scenario-types="dbtbl_with_readwrite_splitting_and_encrypt,encrypt">
<assertion expected-data-file="show_table_rule.xml" />
</test-case>
-
+
<test-case sql="SHOW SHARDING ALGORITHMS">
<assertion expected-data-file="show_algorithms.xml" />
</test-case>
-
+
<test-case sql="SHOW SHARDING BINDING TABLE RULES">
<assertion expected-data-file="show_binging_rules.xml" />
</test-case>
-
+
<test-case sql="SHOW SHARDING BROADCAST TABLE RULES">
<assertion expected-data-file="show_broadcast_rules.xml" />
</test-case>
-
+
<test-case sql="SHOW READWRITE_SPLITTING RULES" scenario-types="dbtbl_with_readwrite_splitting,readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt">
<assertion expected-data-file="show_readwrite_splitting_rules.xml" />
</test-case>
-
+
<test-case sql="SHOW ENCRYPT RULES" scenario-types="dbtbl_with_readwrite_splitting_and_encrypt,encrypt">
<assertion expected-data-file="show_encrypt_rules.xml" />
</test-case>
-
+
<test-case sql="SHOW ENCRYPT TABLE RULE t_user" scenario-types="dbtbl_with_readwrite_splitting_and_encrypt,encrypt">
<assertion expected-data-file="show_encrypt_rule.xml" />
</test-case>
-
+
<!--TODO add db discovery tests-->
<test-case sql="SHOW DB_DISCOVERY RULES" scenario-types="sharding_governance">
<assertion expected-data-file="show_discovery_rules.xml" />
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/empty_rules/mysql/proxy/conf/config-empty-rules.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/empty_rules/mysql/proxy/conf/config-empty-rules.yaml
index ea3e8d1..1da78aa 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/empty_rules/mysql/proxy/conf/config-empty-rules.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/empty_rules/mysql/proxy/conf/config-empty-rules.yaml
@@ -207,3 +207,37 @@ dataSources:
maxLifetimeMilliseconds: 1800000
maxPoolSize: 2
minPoolSize: 2
+
+rules:
+- !SHARDING
+ autoTables:
+ t_user_item:
+ actualDataSources: encrypt_write_ds_${0..9}
+ shardingStrategy:
+ standard:
+ shardingColumn: user_id
+ shardingAlgorithmName: mod
+ keyGenerateStrategy:
+ column: user_id
+ keyGeneratorName: constant
+ shardingAlgorithms:
+ mod:
+ type: MOD
+ props:
+ sharding-count: 40
+
+ keyGenerators:
+ constant:
+ type: CONSTANT
+
+- !READWRITE_SPLITTING
+ dataSources:
+ pr_ds_0:
+ writeDataSourceName: encrypt_write_ds_0
+ readDataSourceNames:
+ - encrypt_read_ds_0
+ loadBalancerName: roundRobin
+
+ loadBalancers:
+ roundRobin:
+ type: ROUND_ROBIN