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

sunnianjun 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 770d60e2c58 Add more integration test for sql federation (#21427)
770d60e2c58 is described below

commit 770d60e2c58aa5a68c0be6e40f0f5391503752e8
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Sun Oct 9 21:11:31 2022 +0800

    Add more integration test for sql federation (#21427)
---
 .../test/integration/engine/dql/BaseDQLIT.java     |  4 +-
 .../cases/dql/dql-integration-test-cases.xml       | 60 +++++++++++++++++++++-
 2 files changed, 60 insertions(+), 4 deletions(-)

diff --git 
a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java
 
b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java
index 6c21fcec2f4..dde0d5e82d5 100644
--- 
a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java
+++ 
b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/BaseDQLIT.java
@@ -38,8 +38,8 @@ import java.util.Collection;
 import java.util.HashSet;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 @Getter(AccessLevel.PROTECTED)
@@ -108,7 +108,7 @@ public abstract class BaseDQLIT extends SingleITCase {
                 if (actualValue instanceof Double || actualValue instanceof 
Float || actualValue instanceof BigDecimal) {
                     
assertThat(Math.floor(Double.parseDouble(actualValue.toString())), 
is(Math.floor(Double.parseDouble(expectedValue.toString()))));
                 } else {
-                    assertThat(actualValue.toString(), 
is(expectedValue.toString()));
+                    assertThat(String.valueOf(actualValue), 
is(String.valueOf(expectedValue)));
                 }
             }
         }
diff --git 
a/test/integration-test/test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
 
b/test/integration-test/test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
index 0392a63c536..ad505a46604 100644
--- 
a/test/integration-test/test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
+++ 
b/test/integration-test/test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
@@ -644,15 +644,71 @@
         <assertion parameters="0:int" 
expected-data-source-name="shadow_dataset" />
     </test-case>
 
+    <test-case sql="SELECT * FROM t_order o INNER JOIN t_order_item i ON 
o.order_id = i.order_id WHERE o.user_id = ? ORDER BY o.order_id, 7" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_order o INNER JOIN t_order_item i ON 
o.order_id = i.order_id WHERE o.user_id = ? ORDER BY o.order_id, 7 LIMIT 1, 2" 
db-types="openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+    
     <test-case sql="SELECT MIN(o.order_id), MIN(o.merchant_id), i.product_id 
FROM t_order o INNER JOIN t_order_item i ON o.order_id = i.order_id WHERE 
o.user_id = ? GROUP BY i.product_id" db-types="PostgreSQL,openGauss" 
scenario-types="db">
         <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
     </test-case>
 
+    <test-case sql="SELECT * FROM t_order o CROSS JOIN t_order_item i WHERE 
o.user_id = ? ORDER BY o.order_id, 7 LIMIT 10, 10" db-types="openGauss" 
scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_order o LEFT JOIN t_order_item i ON 
o.order_id = i.item_id WHERE o.user_id = ? ORDER BY o.order_id, 7" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_order o RIGHT JOIN t_order_item i ON 
o.order_id = i.item_id WHERE i.user_id = ? ORDER BY i.item_id, 7" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_order o FULL JOIN t_order_item i ON 
o.order_id = i.item_id WHERE o.user_id = ? OR i.user_id = ? ORDER BY 
o.order_id, 7" db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int, 10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_order o INNER JOIN t_merchant m ON 
o.merchant_id = m.merchant_id WHERE o.user_id = ? ORDER BY o.order_id" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_order o INNER JOIN t_merchant m ON 
o.merchant_id = m.merchant_id WHERE o.user_id = ? ORDER BY o.order_id LIMIT 1, 
2" db-types="openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT MIN(o.order_id), MIN(o.merchant_id), 
MIN(m.merchant_name) FROM t_order o INNER JOIN t_merchant m ON o.merchant_id = 
m.merchant_id WHERE o.user_id = ? GROUP BY m.merchant_id" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_product p INNER JOIN t_product_detail d ON 
p.product_id = d.product_id WHERE p.product_id > ? ORDER BY p.product_id DESC" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_product p INNER JOIN t_product_detail d ON 
p.product_id = d.product_id WHERE p.product_id > ? ORDER BY p.product_id DESC 
LIMIT 2, 5" db-types="openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT o.order_id, o.user_id, o.status, o.merchant_id, 
(SELECT t.merchant_name FROM t_merchant t WHERE t.merchant_id = o.merchant_id) 
AS merchant_name FROM t_order o WHERE o.order_id = ?" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="1000:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM (SELECT o.* FROM t_order o WHERE o.user_id 
IN (10, 11, 12)) AS t, t_order_item i WHERE t.order_id = i.order_id AND 
t.order_id > ? ORDER BY item_id" db-types="PostgreSQL,openGauss" 
scenario-types="db">
+        <assertion parameters="1200:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+
+    <test-case sql="SELECT * FROM t_order o WHERE o.order_id IN (SELECT 
i.order_id FROM t_order_item i INNER JOIN t_product p ON i.product_id = 
p.product_id WHERE p.product_id = ?) ORDER BY order_id" 
db-types="PostgreSQL,openGauss" scenario-types="db">
+        <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
+    </test-case>
+    
     <test-case sql="SELECT MAX(p.price) AS max_price, MIN(p.price) AS 
min_price, SUM(p.price) AS sum_price, AVG(p.price) AS avg_price, COUNT(1) AS 
count FROM t_order o INNER JOIN t_order_item i ON o.order_id = i.order_id INNER 
JOIN t_product p ON i.product_id = p.product_id GROUP BY o.order_id HAVING 
SUM(p.price) > ? ORDER BY max_price" db-types="PostgreSQL,openGauss" 
scenario-types="db">
         <assertion parameters="10000:int" 
expected-data-source-name="read_dataset" />
     </test-case>
-    
-    <test-case sql="SELECT * FROM t_order o CROSS JOIN t_order_item i WHERE 
o.user_id = ? ORDER BY o.order_id, 7 LIMIT 10, 10" db-types="openGauss" 
scenario-types="db">
+
+    <test-case sql="SELECT * FROM t_order o WHERE o.order_id IN (SELECT 
i.order_id FROM t_order_item i INNER JOIN t_product p ON i.product_id = 
p.product_id WHERE p.product_id = ?) ORDER BY order_id" 
db-types="PostgreSQL,openGauss" scenario-types="db">
         <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
     </test-case>
     

Reply via email to