Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
716f1727
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
716f1727
编写于
3月 26, 2018
作者:
L
liu ze jian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modifying dql and dml
上级
cbe0be1c
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
36 addition
and
27 deletion
+36
-27
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/asserts/AssertEngine.java
...est/java/io/shardingjdbc/dbtest/asserts/AssertEngine.java
+17
-19
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/common/DatabaseUtil.java
...test/java/io/shardingjdbc/dbtest/common/DatabaseUtil.java
+2
-0
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertsDefinition.java
...io/shardingjdbc/dbtest/config/bean/AssertsDefinition.java
+4
-3
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/assert-test.xml
...c/test/resources/asserts/assert-test-data/assert-test.xml
+2
-2
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/asserts/ddl/update.xml
...resources/asserts/assert-test-data/asserts/ddl/update.xml
+8
-0
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/asserts/dml/update.xml
...resources/asserts/assert-test-data/asserts/dml/update.xml
+1
-2
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/asserts/dql/select.xml
...resources/asserts/assert-test-data/asserts/dql/select.xml
+0
-1
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/config/test.yaml
.../test/resources/asserts/assert-test-data/config/test.yaml
+2
-0
未找到文件。
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/asserts/AssertEngine.java
浏览文件 @
716f1727
...
...
@@ -113,9 +113,8 @@ public class AssertEngine {
throw
new
DbTestException
(
path
+
" The use case cannot initialize the data"
);
}
if
(
DatabaseUtil
.
isSelect
(
rootsql
))
{
initTableData
(
dataSourceMaps
,
sqls
,
mapDatasetDefinition
);
try
{
initTableData
(
dataSourceMaps
,
sqls
,
mapDatasetDefinition
);
doSelectUsePreparedStatement
(
rootPath
,
dataSource
,
anAssert
,
rootsql
);
doSelectUsePreparedStatementToExecuteSelect
(
rootPath
,
dataSource
,
anAssert
,
rootsql
);
...
...
@@ -128,7 +127,6 @@ public class AssertEngine {
}
}
}
// dml run
for
(
AssertDMLDefinition
each
:
assertsDefinition
.
getAssertDML
())
{
...
...
@@ -210,7 +208,7 @@ public class AssertEngine {
String
checksql
=
anAssert
.
getExpectedSql
();
checksql
=
SQLCasesLoader
.
getSql
(
checksql
);
DatasetDatabase
ddPreparedStatement
=
DatabaseUtil
.
selectUsePreparedStatement
(
con
,
checksql
,
anAssert
.
getParameters
());
anAssert
.
get
Expected
Parameters
());
DatabaseUtil
.
assertDatas
(
checkDataset
,
ddPreparedStatement
);
}
}
finally
{
...
...
@@ -231,7 +229,7 @@ public class AssertEngine {
String
table
=
anAssert
.
getTable
();
List
<
ColumnDefinition
>
columnDefinitions
=
DatabaseUtil
.
getColumnDefinitions
(
con
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
}
}
finally
{
InItCreateSchema
.
dropTable
();
...
...
@@ -254,7 +252,7 @@ public class AssertEngine {
String
checksql
=
anAssert
.
getExpectedSql
();
checksql
=
SQLCasesLoader
.
getSql
(
checksql
);
DatasetDatabase
ddPreparedStatement
=
DatabaseUtil
.
selectUsePreparedStatement
(
con
,
checksql
,
anAssert
.
getParameters
());
anAssert
.
get
Expected
Parameters
());
DatabaseUtil
.
assertDatas
(
checkDataset
,
ddPreparedStatement
);
}
}
finally
{
...
...
@@ -276,7 +274,7 @@ public class AssertEngine {
String
table
=
anAssert
.
getTable
();
List
<
ColumnDefinition
>
columnDefinitions
=
DatabaseUtil
.
getColumnDefinitions
(
con
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
}
}
finally
{
InItCreateSchema
.
dropTable
();
...
...
@@ -299,7 +297,7 @@ public class AssertEngine {
String
checksql
=
anAssert
.
getExpectedSql
();
checksql
=
SQLCasesLoader
.
getSql
(
checksql
);
DatasetDatabase
ddPreparedStatement
=
DatabaseUtil
.
selectUsePreparedStatement
(
con
,
checksql
,
anAssert
.
getParameters
());
anAssert
.
get
Expected
Parameters
());
DatabaseUtil
.
assertDatas
(
checkDataset
,
ddPreparedStatement
);
}
}
finally
{
...
...
@@ -320,7 +318,7 @@ public class AssertEngine {
String
table
=
anAssert
.
getTable
();
List
<
ColumnDefinition
>
columnDefinitions
=
DatabaseUtil
.
getColumnDefinitions
(
con
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
}
}
finally
{
InItCreateSchema
.
dropTable
();
...
...
@@ -342,7 +340,7 @@ public class AssertEngine {
String
checksql
=
anAssert
.
getExpectedSql
();
checksql
=
SQLCasesLoader
.
getSql
(
checksql
);
DatasetDatabase
ddPreparedStatement
=
DatabaseUtil
.
selectUsePreparedStatement
(
con
,
checksql
,
anAssert
.
getParameters
());
anAssert
.
get
Expected
Parameters
());
DatabaseUtil
.
assertDatas
(
checkDataset
,
ddPreparedStatement
);
}
...
...
@@ -363,7 +361,7 @@ public class AssertEngine {
String
table
=
anAssert
.
getTable
();
List
<
ColumnDefinition
>
columnDefinitions
=
DatabaseUtil
.
getColumnDefinitions
(
con
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
DatabaseUtil
.
assertConfigs
(
checkDataset
,
columnDefinitions
,
table
);
}
}
finally
{
InItCreateSchema
.
dropTable
();
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/common/DatabaseUtil.java
浏览文件 @
716f1727
...
...
@@ -355,6 +355,7 @@ public class DatabaseUtil {
ColumnDefinition
columnDefinition
=
new
ColumnDefinition
();
columnDefinition
.
setName
(
name
);
columnDefinition
.
setType
(
type
);
cols
.
add
(
columnDefinition
);
}
Map
<
String
,
List
<
ColumnDefinition
>>
configs
=
new
HashMap
<>();
...
...
@@ -465,6 +466,7 @@ public class DatabaseUtil {
ColumnDefinition
columnDefinition
=
new
ColumnDefinition
();
columnDefinition
.
setName
(
name
);
columnDefinition
.
setType
(
type
);
cols
.
add
(
columnDefinition
);
}
Map
<
String
,
List
<
ColumnDefinition
>>
configs
=
new
HashMap
<>();
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertsDefinition.java
浏览文件 @
716f1727
...
...
@@ -17,6 +17,7 @@
package
io.shardingjdbc.dbtest.config.bean
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlAttribute
;
...
...
@@ -35,13 +36,13 @@ public class AssertsDefinition {
private
String
path
;
@XmlElement
(
name
=
"assertDQL"
)
private
List
<
AssertDQLDefinition
>
assertDQL
;
private
List
<
AssertDQLDefinition
>
assertDQL
=
new
ArrayList
<>()
;
@XmlElement
(
name
=
"assertDML"
)
private
List
<
AssertDMLDefinition
>
assertDML
;
private
List
<
AssertDMLDefinition
>
assertDML
=
new
ArrayList
<>()
;
@XmlElement
(
name
=
"assertDDL"
)
private
List
<
AssertDDLDefinition
>
assertDDL
;
private
List
<
AssertDDLDefinition
>
assertDDL
=
new
ArrayList
<>()
;
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
...
...
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/assert-test.xml
浏览文件 @
716f1727
...
...
@@ -12,12 +12,12 @@
expected-data-file=
"./asserts/dml/update.xml"
>
<parameters>
<parameter
value=
"update"
/>
<parameter
value=
"1000
1
"
type=
"int"
/>
<parameter
value=
"1000"
type=
"int"
/>
<parameter
value=
"10"
type=
"int"
/>
</parameters>
<expected-parameters>
<parameter
value=
"10"
type=
"int"
/>
<parameter
value=
"1000
1
"
type=
"int"
/>
<parameter
value=
"1000"
type=
"int"
/>
</expected-parameters>
</assertDML>
</asserts>
\ No newline at end of file
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/asserts/ddl/update.xml
0 → 100644
浏览文件 @
716f1727
<init>
<metadata>
<table
name=
"data"
>
<cloumn
name=
"order_id"
type=
"int"
/>
<cloumn
name=
"user_id"
type=
"int"
/>
</table>
</metadata>
</init>
\ No newline at end of file
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/asserts/dml/update.xml
浏览文件 @
716f1727
...
...
@@ -6,7 +6,6 @@
</table>
</metadata>
<dataset>
<data
order_id=
"10001"
user_id=
"10"
/>
<data
order_id=
"1101"
user_id=
"11"
/>
<data
order_id=
"1000"
user_id=
"10"
status=
"update"
/>
</dataset>
</init>
\ No newline at end of file
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/asserts/dql/select.xml
浏览文件 @
716f1727
...
...
@@ -7,6 +7,5 @@
</metadata>
<dataset>
<data
order_id=
"1000"
user_id=
"10"
/>
<data
order_id=
"1101"
user_id=
"11"
/>
</dataset>
</init>
sharding-jdbc-core/src/test/resources/asserts/assert-test-data/config/test.yaml
浏览文件 @
716f1727
...
...
@@ -53,3 +53,5 @@ shardingRule:
complex
:
shardingColumns
:
id, order_id
algorithmClassName
:
io.shardingjdbc.dbtest.core.yaml.fixture.MultiAlgorithm
props
:
sql.show
:
true
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录