Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
d39d59bd
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,发现更多精彩内容 >>
提交
d39d59bd
编写于
5月 06, 2018
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
for #601: base-config => sharding-rule-type
上级
9d99b5a3
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
40 addition
and
40 deletion
+40
-40
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/StartTest.java
...-core/src/test/java/io/shardingjdbc/dbtest/StartTest.java
+1
-1
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/asserts/AssertEngine.java
...est/java/io/shardingjdbc/dbtest/asserts/AssertEngine.java
+12
-12
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertDDLDefinition.java
.../shardingjdbc/dbtest/config/bean/AssertDDLDefinition.java
+2
-2
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertDMLDefinition.java
.../shardingjdbc/dbtest/config/bean/AssertDMLDefinition.java
+2
-2
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertDQLDefinition.java
.../shardingjdbc/dbtest/config/bean/AssertDQLDefinition.java
+2
-2
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertSubDefinition.java
.../shardingjdbc/dbtest/config/bean/AssertSubDefinition.java
+2
-2
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertsDefinition.java
...io/shardingjdbc/dbtest/config/bean/AssertsDefinition.java
+2
-2
sharding-jdbc-core/src/test/resources/asserts/assert-sharding-database-only-with-hint-for-dml-test/assert-test.xml
...ding-database-only-with-hint-for-dml-test/assert-test.xml
+4
-4
sharding-jdbc-core/src/test/resources/asserts/select/assert-test.xml
...bc-core/src/test/resources/asserts/select/assert-test.xml
+13
-13
未找到文件。
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/StartTest.java
浏览文件 @
d39d59bd
...
...
@@ -73,7 +73,7 @@ public final class StartTest {
List
<
String
[]>
result
=
new
LinkedList
<>();
for
(
String
each
:
getAssertFiles
(
integrateResources
))
{
AssertsDefinition
assertsDefinition
=
unmarshal
(
each
);
SHARDING_RULE_TYPES
.
addAll
(
Arrays
.
asList
(
assertsDefinition
.
get
BaseConfig
().
split
(
","
)));
SHARDING_RULE_TYPES
.
addAll
(
Arrays
.
asList
(
assertsDefinition
.
get
ShardingRuleType
().
split
(
","
)));
result
.
addAll
(
getParameters
(
each
,
assertsDefinition
.
getAssertDQL
()));
result
.
addAll
(
getParameters
(
each
,
assertsDefinition
.
getAssertDML
()));
result
.
addAll
(
getParameters
(
each
,
assertsDefinition
.
getAssertDDL
()));
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/asserts/AssertEngine.java
浏览文件 @
d39d59bd
...
...
@@ -84,7 +84,7 @@ public class AssertEngine {
String
rootPath
=
path
.
substring
(
0
,
path
.
lastIndexOf
(
File
.
separator
)
+
1
);
try
{
String
msg
=
"The file path "
+
path
+
", under which id is "
+
id
;
for
(
String
each
:
assertsDefinition
.
get
BaseConfig
().
split
(
","
))
{
for
(
String
each
:
assertsDefinition
.
get
ShardingRuleType
().
split
(
","
))
{
String
initDataFile
=
rootPath
+
assertsDefinition
.
getInitDataFile
();
String
initDataPath
=
initDataFile
+
"/"
+
each
;
File
fileDirDatabase
=
new
File
(
initDataPath
);
...
...
@@ -135,7 +135,7 @@ public class AssertEngine {
if
(!
databaseTypes
.
contains
(
databaseType
))
{
break
;
}
String
baseConfig
=
each
.
get
BaseConfig
();
String
baseConfig
=
each
.
get
ShardingRuleType
();
if
(
StringUtils
.
isNotBlank
(
baseConfig
))
{
String
[]
baseConfigs
=
StringUtils
.
split
(
baseConfig
,
","
);
boolean
flag
=
true
;
...
...
@@ -187,7 +187,7 @@ public class AssertEngine {
if
(!
databaseSubTypes
.
contains
(
databaseType
))
{
break
;
}
String
baseConfig
=
subAssert
.
get
BaseConfig
();
String
baseConfig
=
subAssert
.
get
ShardingRuleType
();
if
(
StringUtils
.
isNotBlank
(
baseConfig
))
{
String
[]
baseConfigs
=
StringUtils
.
split
(
baseConfig
,
","
);
boolean
flag
=
true
;
...
...
@@ -216,7 +216,7 @@ public class AssertEngine {
parameter
=
anAssert
.
getParameter
();
}
AssertDDLDefinition
anAssertSub
=
new
AssertDDLDefinition
(
anAssert
.
getId
(),
anAssert
.
getInitSql
(),
anAssert
.
get
BaseConfig
(),
anAssert
.
getCleanSql
(),
expectedDataFileSub
,
anAssert
.
get
ShardingRuleType
(),
anAssert
.
getCleanSql
(),
expectedDataFileSub
,
anAssert
.
getDatabaseConfig
(),
anAssert
.
getSql
(),
anAssert
.
getTable
(),
parameter
,
anAssert
.
getSubAsserts
());
doUpdateUseStatementToExecuteUpdateDDL
(
shardingRuleType
,
databaseType
,
expectedDataFileTmp
,
dataSource
,
anAssertSub
,
rootsql
,
msg
);
...
...
@@ -233,7 +233,7 @@ public class AssertEngine {
if
(!
databaseTypes
.
contains
(
databaseType
))
{
break
;
}
String
baseConfig
=
each
.
get
BaseConfig
();
String
baseConfig
=
each
.
get
ShardingRuleType
();
if
(
StringUtils
.
isNotBlank
(
baseConfig
))
{
String
[]
baseConfigs
=
StringUtils
.
split
(
baseConfig
,
","
);
boolean
flag
=
true
;
...
...
@@ -279,7 +279,7 @@ public class AssertEngine {
if
(!
databaseSubTypes
.
contains
(
databaseType
))
{
break
;
}
String
baseConfigSub
=
subAssert
.
get
BaseConfig
();
String
baseConfigSub
=
subAssert
.
get
ShardingRuleType
();
if
(
StringUtils
.
isNotBlank
(
baseConfigSub
))
{
String
[]
baseConfigs
=
StringUtils
.
split
(
baseConfigSub
,
","
);
boolean
flag
=
true
;
...
...
@@ -313,7 +313,7 @@ public class AssertEngine {
expectedParameter
=
each
.
getParameter
();
}
AssertDMLDefinition
anAssertSub
=
new
AssertDMLDefinition
(
each
.
getId
(),
expectedDataFileSub
,
each
.
get
BaseConfig
(),
subAssert
.
getExpectedUpdate
(),
each
.
getDatabaseConfig
(),
each
.
getSql
(),
expectedDataFileSub
,
each
.
get
ShardingRuleType
(),
subAssert
.
getExpectedUpdate
(),
each
.
getDatabaseConfig
(),
each
.
getSql
(),
each
.
getExpectedSql
(),
parameter
,
expectedParameter
,
each
.
getSubAsserts
());
resultDoUpdateUseStatementToExecuteUpdate
=
resultDoUpdateUseStatementToExecuteUpdate
+
doUpdateUseStatementToExecuteUpdate
(
expectedDataFileTmp
,
dataSource
,
dataSourceMaps
,
anAssertSub
,
rootSQL
,
mapDatasetDefinition
,
sqls
,
msg
);
resultDoUpdateUseStatementToExecute
=
resultDoUpdateUseStatementToExecute
+
doUpdateUseStatementToExecute
(
expectedDataFileTmp
,
dataSource
,
dataSourceMaps
,
anAssertSub
,
rootSQL
,
mapDatasetDefinition
,
sqls
,
msg
);
...
...
@@ -333,7 +333,7 @@ public class AssertEngine {
if
(!
databaseSubTypes
.
contains
(
databaseType
))
{
break
;
}
String
baseConfigSub
=
subAssert
.
get
BaseConfig
();
String
baseConfigSub
=
subAssert
.
get
ShardingRuleType
();
if
(
StringUtils
.
isNotBlank
(
baseConfigSub
))
{
String
[]
baseConfigs
=
StringUtils
.
split
(
baseConfigSub
,
","
);
boolean
flag
=
true
;
...
...
@@ -366,7 +366,7 @@ public class AssertEngine {
expectedParameter
=
each
.
getParameter
();
}
AssertDMLDefinition
anAssertSub
=
new
AssertDMLDefinition
(
each
.
getId
(),
expectedDataFileSub
,
each
.
get
BaseConfig
(),
subAssert
.
getExpectedUpdate
(),
each
.
getDatabaseConfig
(),
each
.
getSql
(),
expectedDataFileSub
,
each
.
get
ShardingRuleType
(),
subAssert
.
getExpectedUpdate
(),
each
.
getDatabaseConfig
(),
each
.
getSql
(),
each
.
getExpectedSql
(),
parameter
,
expectedParameter
,
each
.
getSubAsserts
());
resultDoUpdateUseStatementToExecuteUpdate
=
resultDoUpdateUseStatementToExecuteUpdate
+
doUpdateUseStatementToExecuteUpdate
(
expectedDataFileTmp
,
dataSource
,
dataSourceMaps
,
anAssertSub
,
rootSQL
,
mapDatasetDefinition
,
sqls
,
msg
);
resultDoUpdateUseStatementToExecute
=
resultDoUpdateUseStatementToExecute
+
doUpdateUseStatementToExecute
(
expectedDataFileTmp
,
dataSource
,
dataSourceMaps
,
anAssertSub
,
rootSQL
,
mapDatasetDefinition
,
sqls
,
msg
);
...
...
@@ -394,7 +394,7 @@ public class AssertEngine {
if
(!
databaseTypes
.
contains
(
databaseType
))
{
break
;
}
String
baseConfig
=
each
.
get
BaseConfig
();
String
baseConfig
=
each
.
get
ShardingRuleType
();
if
(
StringUtils
.
isNotBlank
(
baseConfig
))
{
String
[]
baseConfigs
=
StringUtils
.
split
(
baseConfig
,
","
);
boolean
flag
=
true
;
...
...
@@ -458,7 +458,7 @@ public class AssertEngine {
if
(!
databaseSubTypes
.
contains
(
databaseType
))
{
break
;
}
String
baseSubConfig
=
subAssert
.
get
BaseConfig
();
String
baseSubConfig
=
subAssert
.
get
ShardingRuleType
();
if
(
StringUtils
.
isNotBlank
(
baseSubConfig
))
{
String
[]
baseConfigs
=
StringUtils
.
split
(
baseSubConfig
,
","
);
boolean
flag
=
true
;
...
...
@@ -487,7 +487,7 @@ public class AssertEngine {
parameter
=
anAssert
.
getParameter
();
}
AssertDQLDefinition
anAssertSub
=
new
AssertDQLDefinition
(
anAssert
.
getId
(),
anAssert
.
get
BaseConfig
(),
expectedDataFileSub
,
anAssert
.
get
ShardingRuleType
(),
expectedDataFileSub
,
anAssert
.
getDatabaseConfig
(),
anAssert
.
getSql
(),
parameter
,
anAssert
.
getSubAsserts
());
doSelectUsePreparedStatement
(
expectedDataFileTmp
,
dataSource
,
anAssertSub
,
rootSQL
,
msg
);
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertDDLDefinition.java
浏览文件 @
d39d59bd
...
...
@@ -40,8 +40,8 @@ public class AssertDDLDefinition implements AssertDefinition {
@XmlAttribute
(
name
=
"init-sql"
)
private
String
initSql
;
@XmlAttribute
(
name
=
"
base-config
"
)
private
String
baseConfig
;
@XmlAttribute
(
name
=
"
sharding-rule-type
"
)
private
String
shardingRuleType
;
@XmlAttribute
(
name
=
"clean-sql"
)
private
String
cleanSql
;
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertDMLDefinition.java
浏览文件 @
d39d59bd
...
...
@@ -40,8 +40,8 @@ public class AssertDMLDefinition implements AssertDefinition {
@XmlAttribute
(
name
=
"expected-data-file"
)
private
String
expectedDataFile
;
@XmlAttribute
(
name
=
"
base-config
"
)
private
String
baseConfig
;
@XmlAttribute
(
name
=
"
sharding-rule-type
"
)
private
String
shardingRuleType
;
@XmlAttribute
(
name
=
"expected-update"
)
private
Integer
expectedUpdate
;
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertDQLDefinition.java
浏览文件 @
d39d59bd
...
...
@@ -40,8 +40,8 @@ public class AssertDQLDefinition implements AssertDefinition {
@XmlAttribute
(
name
=
"expected-data-file"
)
private
String
expectedDataFile
;
@XmlAttribute
(
name
=
"
base-config
"
)
private
String
baseConfig
;
@XmlAttribute
(
name
=
"
sharding-rule-type
"
)
private
String
shardingRuleType
;
@XmlAttribute
(
name
=
"database-config"
)
private
String
databaseConfig
=
"H2,MySQL,Oracle,SQLServer,PostgreSQL"
;
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertSubDefinition.java
浏览文件 @
d39d59bd
...
...
@@ -25,8 +25,8 @@ import javax.xml.bind.annotation.*;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
AssertSubDefinition
{
@XmlAttribute
(
name
=
"
base-config
"
)
private
String
baseConfig
;
@XmlAttribute
(
name
=
"
sharding-rule-type
"
)
private
String
shardingRuleType
;
@XmlAttribute
(
name
=
"expected-data-file"
)
private
String
expectedDataFile
;
...
...
sharding-jdbc-core/src/test/java/io/shardingjdbc/dbtest/config/bean/AssertsDefinition.java
浏览文件 @
d39d59bd
...
...
@@ -29,8 +29,8 @@ import java.util.List;
@XmlRootElement
(
name
=
"asserts"
)
public
class
AssertsDefinition
{
@XmlAttribute
(
name
=
"
base-config
"
)
private
String
baseConfig
=
"db,dbtbl,nullable"
;
@XmlAttribute
(
name
=
"
sharding-rule-type
"
)
private
String
shardingRuleType
=
"db,dbtbl,nullable"
;
@XmlAttribute
(
name
=
"database-config"
)
private
String
databaseConfig
=
"H2,MySQL,Oracle,SQLServer,PostgreSQL"
;
...
...
sharding-jdbc-core/src/test/resources/asserts/assert-sharding-database-only-with-hint-for-dml-test/assert-test.xml
浏览文件 @
d39d59bd
<asserts
init-data-file=
"./init"
base-config
=
"db"
>
<assertDML
id=
"assertInsertWithAllPlaceholders"
expected-update=
"9"
sql=
"assertInsertWithAllPlaceholders"
base-config
=
"db"
expected-sql=
"assertSelectEqualsWithSingleTable"
>
<asserts
init-data-file=
"./init"
sharding-rule-type
=
"db"
>
<assertDML
id=
"assertInsertWithAllPlaceholders"
expected-update=
"9"
sql=
"assertInsertWithAllPlaceholders"
sharding-rule-type
=
"db"
expected-sql=
"assertSelectEqualsWithSingleTable"
>
<subAssert
expected-data-file=
"insert/db_1.xml"
>
<parameter>
<value
value=
"1"
type=
"int"
/>
...
...
@@ -100,7 +100,7 @@
</expected-parameter>
</subAssert>
</assertDML>
<assertDML
id=
"assertInsertWithoutPlaceholder"
expected-update=
"9"
sql=
"assertInsertWithPartialPlaceholder"
base-config
=
"db"
expected-sql=
"assertSelectEqualsWithSingleTable"
>
<assertDML
id=
"assertInsertWithoutPlaceholder"
expected-update=
"9"
sql=
"assertInsertWithPartialPlaceholder"
sharding-rule-type
=
"db"
expected-sql=
"assertSelectEqualsWithSingleTable"
>
<subAssert
expected-data-file=
"insert/db_1.xml"
>
<parameter>
<value
value=
"1"
type=
"int"
/>
...
...
@@ -194,7 +194,7 @@
</assertDML>
<!--
<assertDML id="assertInsertWithPartialPlaceholders" expected-update="9"
sql="assertInsertWithPartialPlaceholders"
base-config
="db"
sql="assertInsertWithPartialPlaceholders"
sharding-rule-type
="db"
expected-sql="assertSelectEqualsWithSingleTable"
>
<subAssert expected-data-file="insert/db_1.xml">
...
...
sharding-jdbc-core/src/test/resources/asserts/select/assert-test.xml
浏览文件 @
d39d59bd
<asserts
init-data-file=
"./init"
base-config
=
"db,tbl,dbtbl,masterslave"
>
<asserts
init-data-file=
"./init"
sharding-rule-type
=
"db,tbl,dbtbl,masterslave"
>
<assertDQL
id=
"assertSelectOne"
sql=
"assertSelectOne"
expected-data-file=
"SelectOne.xml"
>
</assertDQL>
<assertDQL
id=
"assertSelectNotEqualsWithSingleTable"
sql=
"assertSelectNotEqualsWithSingleTable"
base-config
=
"tbl"
sql=
"assertSelectNotEqualsWithSingleTable"
sharding-rule-type
=
"tbl"
expected-data-file=
"SelectNotEqualsWithSingleTable.xml"
>
<parameter>
<value
value=
"100000"
type=
"int"
/>
</parameter>
</assertDQL>
<assertDQL
id=
"assertSelectNotEqualsWithSingleTableForExclamationEqual"
sql=
"assertSelectNotEqualsWithSingleTableForExclamationEqual"
base-config
=
"tbl"
sql=
"assertSelectNotEqualsWithSingleTableForExclamationEqual"
sharding-rule-type
=
"tbl"
expected-data-file=
"SelectNotEqualsWithSingleTable.xml"
>
<parameter>
<value
value=
"100000"
type=
"int"
/>
</parameter>
</assertDQL>
<assertDQL
id=
"assertSelectNotEqualsWithSingleTableForNotIn"
sql=
"assertSelectNotEqualsWithSingleTableForNotIn"
base-config
=
"tbl"
sql=
"assertSelectNotEqualsWithSingleTableForNotIn"
sharding-rule-type
=
"tbl"
expected-data-file=
"SelectNotEqualsWithSingleTable.xml"
>
<parameter>
<value
value=
"100000"
type=
"int"
/>
</parameter>
</assertDQL>
<assertDQL
id=
"assertSelectEqualsWithSameShardingColumns"
sql=
"assertSelectEqualsWithSameShardingColumns"
base-config
=
"tbl"
sql=
"assertSelectEqualsWithSameShardingColumns"
sharding-rule-type
=
"tbl"
expected-data-file=
"SelectEqualsWithSameShardingColumns.xml"
>
<parameter>
<value
value=
"1000"
type=
"int"
/>
...
...
@@ -33,7 +33,7 @@
</parameter>
</assertDQL>
<assertDQL
id=
"assertSelectInWithSameShardingColumns"
sql=
"assertSelectInWithSameShardingColumns"
base-config
=
"tbl"
sql=
"assertSelectInWithSameShardingColumns"
sharding-rule-type
=
"tbl"
expected-data-file=
"SelectInWithSameShardingColumns.xml"
>
<parameter>
<value
value=
"1000"
type=
"int"
/>
...
...
@@ -43,21 +43,21 @@
</parameter>
</assertDQL>
<assertDQL
id=
"assertSelectEqualsWithSingleTable"
sql=
"assertSelectEqualsWithSingleTable"
base-config
=
"tbl,db,masterslave,dbtbl"
sql=
"assertSelectEqualsWithSingleTable"
sharding-rule-type
=
"tbl,db,masterslave,dbtbl"
expected-data-file=
"SelectEqualsWithSingleTable_1.xml"
>
<subAssert
expected-data-file=
"SelectEqualsWithSingleTable_0.xml"
base-config
=
"tbl"
>
<subAssert
expected-data-file=
"SelectEqualsWithSingleTable_0.xml"
sharding-rule-type
=
"tbl"
>
<parameter>
<value
value=
"10"
type=
"int"
/>
<value
value=
"1000"
type=
"int"
/>
</parameter>
</subAssert>
<subAssert
expected-data-file=
"SelectEqualsWithSingleTable_1.xml"
base-config
=
"tbl"
>
<subAssert
expected-data-file=
"SelectEqualsWithSingleTable_1.xml"
sharding-rule-type
=
"tbl"
>
<parameter>
<value
value=
"11"
type=
"int"
/>
<value
value=
"1109"
type=
"int"
/>
</parameter>
</subAssert>
<subAssert
expected-data-file=
"SelectEqualsWithSingleTable_2.xml"
base-config
=
"db,masterslave,dbtbl"
>
<subAssert
expected-data-file=
"SelectEqualsWithSingleTable_2.xml"
sharding-rule-type
=
"db,masterslave,dbtbl"
>
<parameter>
<value
value=
"12"
type=
"int"
/>
<value
value=
"1201"
type=
"int"
/>
...
...
@@ -72,9 +72,9 @@
</assertDQL>
<!--<assertDQL id="assertSelectBetweenWithSingleTable"
sql="assertSelectBetweenWithSingleTable"
base-config
="tbl,db,dbtbl"
sql="assertSelectBetweenWithSingleTable"
sharding-rule-type
="tbl,db,dbtbl"
>
<subAssert expected-data-file="SelectBetweenWithSingleTable.xml"
base-config
="tbl,dbtbl">
<subAssert expected-data-file="SelectBetweenWithSingleTable.xml"
sharding-rule-type
="tbl,dbtbl">
<parameter>
<value value="10" type="int"/>
<value value="12" type="int"/>
...
...
@@ -82,7 +82,7 @@
<value value="1108" type="int"/>
</parameter>
</subAssert>
<subAssert expected-data-file="SelectBetweenWithSingleTable.xml"
base-config
="db">
<subAssert expected-data-file="SelectBetweenWithSingleTable.xml"
sharding-rule-type
="db">
<parameter>
<value value="10" type="int"/>
<value value="12" type="int"/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录