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 32e2295  Refactor 
SELECT_SQL_BY_ID_ACROSS_SINGLE_AND_SHARDING_TABLES_ORDER_BY statement with 
shardingsphere-integration-test (#12096)
32e2295 is described below

commit 32e22952f667f55b45f7e1aae5a4e2385dd980b8
Author: liguoping <[email protected]>
AuthorDate: Mon Aug 30 16:16:03 2021 +0800

    Refactor SELECT_SQL_BY_ID_ACROSS_SINGLE_AND_SHARDING_TABLES_ORDER_BY 
statement with shardingsphere-integration-test (#12096)
---
 .../jdbc/core/statement/FederateStatementTest.java | 32 +---------------------
 ..._across_single_and_sharding_tables_order_by.xml | 26 ++++++++++++++++++
 ..._across_single_and_sharding_tables_order_by.xml | 26 ++++++++++++++++++
 ..._across_single_and_sharding_tables_order_by.xml | 26 ++++++++++++++++++
 .../cases/dql/dql-integration-test-cases.xml       |  4 +++
 5 files changed, 83 insertions(+), 31 deletions(-)

diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/FederateStatementTest.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/FederateStatementTest.java
index f6e8573..3afe9f9 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/FederateStatementTest.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/FederateStatementTest.java
@@ -40,11 +40,6 @@ public final class FederateStatementTest extends 
AbstractShardingSphereDataSourc
                     + "where t_order_federate.order_id = 
t_order_item_federate_sharding.item_id "
                     + "AND t_order_item_federate_sharding.remarks = 
't_order_item_federate_sharding'";
 
-    private static final String 
SELECT_SQL_BY_ID_ACROSS_SINGLE_AND_SHARDING_TABLES_ORDER_BY =
-            "select t_order_federate.* from t_order_federate, 
t_order_item_federate_sharding "
-                    + "where t_order_federate.order_id = 
t_order_item_federate_sharding.item_id "
-                    + "ORDER BY t_order_item_federate_sharding.user_id";
-
     private static final String 
SELECT_SQL_BY_ID_ACROSS_SINGLE_TABLES_WITH_ENCRYPT =
             "select t_user_encrypt_federate.user_id, 
t_user_encrypt_federate.pwd, t_user_info.information from 
t_user_encrypt_federate, t_user_info "
             + "where t_user_encrypt_federate.user_id = t_user_info.user_id ";
@@ -106,32 +101,7 @@ public final class FederateStatementTest extends 
AbstractShardingSphereDataSourc
         assertThat(resultSet.getInt(5), is(10001));
         assertFalse(resultSet.next());
     }
-    
-    @Test
-    public void 
assertQueryWithFederateInSingleAndShardingTableOrderByByExecuteQuery() throws 
SQLException {
-        assertQueryWithFederateInSingleAndShardingTableOrderBy(true);   
-    }
-    
-    @Test
-    public void 
assertQueryWithFederateInSingleAndShardingTableOrderByByExecute() throws 
SQLException {
-        assertQueryWithFederateInSingleAndShardingTableOrderBy(false);
-    }
-    
-    private void assertQueryWithFederateInSingleAndShardingTableOrderBy(final 
boolean executeQuery) throws SQLException {
-        ShardingSphereStatement statement = (ShardingSphereStatement) 
getShardingSphereDataSource().getConnection().createStatement();
-        ResultSet resultSet = getResultSet(statement, 
SELECT_SQL_BY_ID_ACROSS_SINGLE_AND_SHARDING_TABLES_ORDER_BY, executeQuery);
-        assertNotNull(resultSet);
-        assertTrue(resultSet.next());
-        assertThat(resultSet.getInt(1), is(1000));
-        assertThat(resultSet.getInt(2), is(10));
-        assertThat(resultSet.getString(3), is("init"));
-        assertTrue(resultSet.next());
-        assertThat(resultSet.getInt(1), is(1001));
-        assertThat(resultSet.getInt(2), is(11));
-        assertThat(resultSet.getString(3), is("init"));
-        assertFalse(resultSet.next());
-    }
-    
+
     @Test
     public void 
assertQueryWithFederateInSingleTablesWithEncryptRuleByExecuteQuery() throws 
SQLException {
         assertQueryWithFederateInSingleTablesWithEncryptRule(true);
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/db/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/db/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
new file mode 100644
index 0000000..2fb6416
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/db/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
@@ -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.
+  -->
+
+<dataset>
+    <metadata>
+        <column name="order_id" />
+        <column name="user_id" />
+        <column name="status" />
+    </metadata>
+    <row values="1000, 10, init" />
+    <row values="1001, 11, init" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/dbtbl_with_readwrite_splitting/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/dbtbl_with_readwrite_splitting/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
new file mode 100644
index 0000000..2fb6416
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/dbtbl_with_readwrite_splitting/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
@@ -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.
+  -->
+
+<dataset>
+    <metadata>
+        <column name="order_id" />
+        <column name="user_id" />
+        <column name="status" />
+    </metadata>
+    <row values="1000, 10, init" />
+    <row values="1001, 11, init" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
new file mode 100644
index 0000000..2fb6416
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/select_sql_by_id_across_single_and_sharding_tables_order_by.xml
@@ -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.
+  -->
+
+<dataset>
+    <metadata>
+        <column name="order_id" />
+        <column name="user_id" />
+        <column name="status" />
+    </metadata>
+    <row values="1000, 10, init" />
+    <row values="1001, 11, init" />
+</dataset>
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
index c845847..67094e4 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
@@ -591,5 +591,9 @@
     <test-case sql="select t_user_encrypt_federate_sharding.user_id, 
t_user_encrypt_federate_sharding.pwd, t_user_info.information from 
t_user_encrypt_federate_sharding, t_user_info where 
t_user_encrypt_federate_sharding.user_id = t_user_info.user_id and 
t_user_encrypt_federate_sharding.user_id > ? " 
scenario-types="dbtbl_with_readwrite_splitting_and_encrypt">
         <assertion parameters="1:int" 
expected-data-file="select_sql_by_id_across_single_and_sharding_tables_with_encrypt_user_id.xml"
 />
     </test-case>
+
+    <test-case sql="select t_order_federate.* from t_order_federate, 
t_order_item_federate_sharding where t_order_federate.order_id = 
t_order_item_federate_sharding.item_id ORDER BY 
t_order_item_federate_sharding.user_id" 
scenario-types="db,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt">
+        <assertion 
expected-data-file="select_sql_by_id_across_single_and_sharding_tables_order_by.xml"
 />
+    </test-case>
     
 </integration-test-cases>

Reply via email to