Skip to content

Commit

Permalink
Merge pull request #1345 from haocao/dev
Browse files Browse the repository at this point in the history
for #1316, update test cases.
  • Loading branch information
terrymanu authored Oct 17, 2018
2 parents 3086266 + 024aa62 commit 2852ac9
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 41 deletions.
2 changes: 1 addition & 1 deletion sharding-core/src/test/resources/parser/delete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<table name="t_order" />
</tables>
<tokens>
<table-token begin-position="7" original-literals="`t_order`" />
<table-token begin-position="12" original-literals="`t_order`" />
</tokens>
</parser-result>

Expand Down
4 changes: 2 additions & 2 deletions sharding-core/src/test/resources/parser/insert.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
<table name="t_order" />
</tables>
<tokens>
<table-token begin-position="33" original-literals="`t_order`" />
<insert-values-token begin-position="84" table-name="t_order"/>
<table-token begin-position="33" original-literals="t_order" />
<insert-values-token begin-position="76" table-name="t_order"/>
</tokens>
<or-condition>
<and-condition>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static DataSource createDBCP(final DatabaseType databaseType, final Stri
result.setUrl(null == dataSourceName ? databaseEnvironment.getURL() : databaseEnvironment.getURL(dataSourceName));
result.setUsername(databaseEnvironment.getUsername());
result.setPassword(databaseEnvironment.getPassword());
result.setMaxTotal(5);
result.setMaxTotal(15);
result.setValidationQuery("SELECT 1");
if (DatabaseType.Oracle == databaseType) {
result.setConnectionInitSqls(Collections.singleton("ALTER SESSION SET CURRENT_SCHEMA = " + dataSourceName));
Expand All @@ -93,7 +93,7 @@ private static DataSource createHikariCP(final DatabaseType databaseType, final
result.setJdbcUrl(null == dataSourceName ? databaseEnvironment.getURL() : databaseEnvironment.getURL(dataSourceName));
result.setUsername(databaseEnvironment.getUsername());
result.setPassword(databaseEnvironment.getPassword());
result.setMaximumPoolSize(5);
result.setMaximumPoolSize(15);
result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
result.setConnectionTestQuery("SELECT 1");
if (DatabaseType.Oracle == databaseType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
</dml-test-case>

<dml-test-case sql-case-id="delete_with_special_character_without_sharding_value">
<assertion expected-data-file="delete_with_special_character_without_sharding_value.xml" />
<assertion expected-data-file="delete_with_sharding_value.xml" />
</dml-test-case>

<dml-test-case sql-case-id="delete_with_special_comments_without_sharding_value">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="19" />
<row values="19" />
<row values="19" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,5 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="19" />
<row values="19" />
<row values="19" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,4 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
initialized=false
run.additional.cases=false
sharding.rule.type=db,tbl,dbtbl_with_masterslave,masterslave

Expand Down
2 changes: 1 addition & 1 deletion sharding-sql-test/src/main/resources/sql/dml/delete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<sql-cases>
<sql-case id="delete_with_sharding_value" value="DELETE FROM t_order WHERE order_id = ? AND user_id = ? AND status=?" />
<sql-case id="delete_without_sharding_value" value="DELETE FROM t_order WHERE status=?" />
<sql-case id="delete_with_special_character_without_sharding_value" value="DELETE `t_order` WHERE `status`=1" db-types="MySQL" />
<sql-case id="delete_with_special_character_without_sharding_value" value="DELETE FROM `t_order` WHERE `status`='init'" db-types="MySQL" />
<sql-case id="delete_with_special_comments_return_without_sharding_value" value="DELETE /*+ index(status) */ ONLY t_order WHERE status=1 RETURN * LOG ERRORS INTO TABLE_LOG" db-types="Oracle" />
<sql-case id="delete_with_special_comments_returning_without_sharding_value" value="DELETE /*+ index(status) */ ONLY (t_order) WHERE status=1 RETURNING *" db-types="Oracle" />
</sql-cases>
2 changes: 1 addition & 1 deletion sharding-sql-test/src/main/resources/sql/dml/insert.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<sql-case id="insert_with_all_placeholders" value="INSERT INTO t_order (order_id, user_id, status) VALUES (?, ?, ?)" />
<sql-case id="insert_without_parameters" value="INSERT INTO t_order (order_id, user_id, status) VALUES (1, 1, 'insert')" />
<sql-case id="insert_with_special_characters" value="INSERT INTO `t_order` (`order_id`, `user_id`, `status`) VALUES (1, 1, 'insert')" db-types="MySQL" />
<sql-case id="insert_with_special_syntax" value="INSERT /*+ index(field1) */ INTO `t_order` (`order_id`, `user_id`, `status`) VALUES (1, 1, 'insert') RETURNING order_id*2 LOG ERRORS INTO TABLE_LOG" db-types="MySQL" />
<sql-case id="insert_with_special_syntax" value="INSERT /*+ index(field1) */ INTO t_order (order_id, user_id, status) VALUES (1, 1, 'insert') RETURNING order_id" db-types="PostgreSQL" />
<sql-case id="insert_with_all_placeholders_for_table_identifier" value="INSERT INTO t_order (t_order.order_id, t_order.user_id, t_order.status) VALUES (?, ?, ?)" />
<sql-case id="insert_without_columns_with_all_placeholders" value="INSERT INTO t_order VALUES (?, ?, ?)" />
<sql-case id="insert_set_with_all_placeholders" value="INSERT INTO t_order SET order_id = ?, user_id = ?, status = ?" db-types="MySQL" />
Expand Down

0 comments on commit 2852ac9

Please sign in to comment.