Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
953bb754
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,体验更适合开发者的 AI 搜索 >>
提交
953bb754
编写于
1月 10, 2019
作者:
T
tristaZero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify import
上级
fffd717e
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
13 addition
and
13 deletion
+13
-13
sharding-core/src/main/java/io/shardingsphere/core/rule/ShardingRule.java
...c/main/java/io/shardingsphere/core/rule/ShardingRule.java
+2
-2
sharding-core/src/test/java/io/shardingsphere/core/rule/ShardingRuleTest.java
...st/java/io/shardingsphere/core/rule/ShardingRuleTest.java
+2
-2
sharding-core/src/test/java/io/shardingsphere/core/yaml/sharding/YamlShardingConfigurationTest.java
...ere/core/yaml/sharding/YamlShardingConfigurationTest.java
+3
-3
sharding-core/src/test/java/io/shardingsphere/core/yaml/sharding/YamlShardingRuleConfigurationTest.java
...core/yaml/sharding/YamlShardingRuleConfigurationTest.java
+3
-3
sharding-core/src/test/java/io/shardingsphere/core/yaml/sharding/YamlTableRuleConfigurationTest.java
...re/core/yaml/sharding/YamlTableRuleConfigurationTest.java
+3
-3
未找到文件。
sharding-core/src/main/java/io/shardingsphere/core/rule/ShardingRule.java
浏览文件 @
953bb754
...
...
@@ -27,7 +27,7 @@ import io.shardingsphere.api.config.rule.TableRuleConfiguration;
import
io.shardingsphere.api.config.strategy.ShardingStrategyConfiguration
;
import
io.shardingsphere.core.exception.ShardingConfigurationException
;
import
io.shardingsphere.core.exception.ShardingException
;
import
io.shardingsphere.core.keygen.
Default
KeyGenerator
;
import
io.shardingsphere.core.keygen.
Snowflake
KeyGenerator
;
import
io.shardingsphere.core.keygen.KeyGenerator
;
import
io.shardingsphere.core.parsing.parser.context.condition.Column
;
import
io.shardingsphere.core.routing.strategy.ShardingStrategy
;
...
...
@@ -111,7 +111,7 @@ public class ShardingRule {
}
private
KeyGenerator
createDefaultKeyGenerator
(
final
KeyGenerator
defaultKeyGenerator
)
{
return
null
==
defaultKeyGenerator
?
new
Default
KeyGenerator
()
:
defaultKeyGenerator
;
return
null
==
defaultKeyGenerator
?
new
Snowflake
KeyGenerator
()
:
defaultKeyGenerator
;
}
private
Collection
<
MasterSlaveRule
>
createMasterSlaveRules
(
final
Collection
<
MasterSlaveRuleConfiguration
>
masterSlaveRuleConfigurations
)
{
...
...
sharding-core/src/test/java/io/shardingsphere/core/rule/ShardingRuleTest.java
浏览文件 @
953bb754
...
...
@@ -26,7 +26,7 @@ import io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
import
io.shardingsphere.api.config.strategy.NoneShardingStrategyConfiguration
;
import
io.shardingsphere.api.config.strategy.StandardShardingStrategyConfiguration
;
import
io.shardingsphere.core.exception.ShardingConfigurationException
;
import
io.shardingsphere.core.keygen.
Default
KeyGenerator
;
import
io.shardingsphere.core.keygen.
Snowflake
KeyGenerator
;
import
io.shardingsphere.core.keygen.fixture.IncrementKeyGenerator
;
import
io.shardingsphere.core.parsing.parser.context.condition.Column
;
import
io.shardingsphere.core.routing.strategy.inline.InlineShardingStrategy
;
...
...
@@ -73,7 +73,7 @@ public final class ShardingRuleTest {
assertTrue
(
actual
.
getBroadcastTables
().
isEmpty
());
assertThat
(
actual
.
getDefaultDatabaseShardingStrategy
(),
instanceOf
(
NoneShardingStrategy
.
class
));
assertThat
(
actual
.
getDefaultTableShardingStrategy
(),
instanceOf
(
NoneShardingStrategy
.
class
));
assertThat
(
actual
.
getDefaultKeyGenerator
(),
instanceOf
(
Default
KeyGenerator
.
class
));
assertThat
(
actual
.
getDefaultKeyGenerator
(),
instanceOf
(
Snowflake
KeyGenerator
.
class
));
}
@Test
...
...
sharding-core/src/test/java/io/shardingsphere/core/yaml/sharding/YamlShardingConfigurationTest.java
浏览文件 @
953bb754
...
...
@@ -18,7 +18,7 @@
package
io.shardingsphere.core.yaml.sharding
;
import
io.shardingsphere.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithmType
;
import
io.shardingsphere.core.keygen.
Default
KeyGenerator
;
import
io.shardingsphere.core.keygen.
Snowflake
KeyGenerator
;
import
org.hamcrest.CoreMatchers
;
import
org.junit.Test
;
...
...
@@ -105,7 +105,7 @@ public final class YamlShardingConfigurationTest {
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getInline
().
getShardingColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getInline
().
getAlgorithmExpression
(),
is
(
"t_order_${order_id % 2}"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getKeyGenerator
().
getColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getKeyGenerator
().
getClassName
(),
is
(
Default
KeyGenerator
.
class
.
getName
()));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getKeyGenerator
().
getClassName
(),
is
(
Snowflake
KeyGenerator
.
class
.
getName
()));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getLogicIndex
(),
is
(
"order_index"
));
}
...
...
@@ -130,7 +130,7 @@ public final class YamlShardingConfigurationTest {
assertThat
(
actual
.
getShardingRule
().
getDefaultDataSourceName
(),
is
(
"default_ds"
));
assertThat
(
actual
.
getShardingRule
().
getDefaultDatabaseStrategy
().
getInline
().
getShardingColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShardingRule
().
getDefaultDatabaseStrategy
().
getInline
().
getAlgorithmExpression
(),
is
(
"ds_${order_id % 2}"
));
assertThat
(
actual
.
getShardingRule
().
getDefaultKeyGenerator
().
getKeyGenerator
().
getClass
().
getName
(),
is
(
Default
KeyGenerator
.
class
.
getName
()));
assertThat
(
actual
.
getShardingRule
().
getDefaultKeyGenerator
().
getKeyGenerator
().
getClass
().
getName
(),
is
(
Snowflake
KeyGenerator
.
class
.
getName
()));
}
private
void
assertMasterSlaveRules
(
final
YamlShardingConfiguration
actual
)
{
...
...
sharding-core/src/test/java/io/shardingsphere/core/yaml/sharding/YamlShardingRuleConfigurationTest.java
浏览文件 @
953bb754
...
...
@@ -23,7 +23,7 @@ import io.shardingsphere.api.config.rule.MasterSlaveRuleConfiguration;
import
io.shardingsphere.api.config.rule.ShardingRuleConfiguration
;
import
io.shardingsphere.api.config.rule.TableRuleConfiguration
;
import
io.shardingsphere.api.config.strategy.NoneShardingStrategyConfiguration
;
import
io.shardingsphere.core.keygen.
Default
KeyGenerator
;
import
io.shardingsphere.core.keygen.
Snowflake
KeyGenerator
;
import
io.shardingsphere.core.yaml.masterslave.YamlMasterSlaveRuleConfiguration
;
import
io.shardingsphere.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration
;
import
org.hamcrest.CoreMatchers
;
...
...
@@ -62,7 +62,7 @@ public final class YamlShardingRuleConfigurationTest {
result
.
getBindingTables
().
add
(
"t_order, t_order_item"
);
result
.
getBroadcastTables
().
add
(
"t_config"
);
YamlKeyGeneratorConfiguration
keyGeneratorConfiguration
=
new
YamlKeyGeneratorConfiguration
();
keyGeneratorConfiguration
.
setClassName
(
Default
KeyGenerator
.
class
.
getName
());
keyGeneratorConfiguration
.
setClassName
(
Snowflake
KeyGenerator
.
class
.
getName
());
result
.
setDefaultKeyGenerator
(
keyGeneratorConfiguration
);
result
.
getMasterSlaveRules
().
put
(
"master_slave_ds"
,
createYamlMasterSlaveRuleConfig
());
return
result
;
...
...
@@ -97,7 +97,7 @@ public final class YamlShardingRuleConfigurationTest {
assertThat
(
actual
.
getBindingTableGroups
().
iterator
().
next
(),
is
(
"t_order, t_order_item"
));
assertThat
(
actual
.
getBroadcastTables
().
size
(),
is
(
1
));
assertThat
(
actual
.
getBroadcastTables
().
iterator
().
next
(),
is
(
"t_config"
));
assertThat
(
actual
.
getDefaultKeyGenerator
(),
instanceOf
(
Default
KeyGenerator
.
class
));
assertThat
(
actual
.
getDefaultKeyGenerator
(),
instanceOf
(
Snowflake
KeyGenerator
.
class
));
assertMasterSlaveRuleConfig
(
actual
.
getMasterSlaveRuleConfigs
().
iterator
().
next
());
}
...
...
sharding-core/src/test/java/io/shardingsphere/core/yaml/sharding/YamlTableRuleConfigurationTest.java
浏览文件 @
953bb754
...
...
@@ -19,7 +19,7 @@ package io.shardingsphere.core.yaml.sharding;
import
io.shardingsphere.api.config.rule.TableRuleConfiguration
;
import
io.shardingsphere.api.config.strategy.NoneShardingStrategyConfiguration
;
import
io.shardingsphere.core.keygen.
Default
KeyGenerator
;
import
io.shardingsphere.core.keygen.
Snowflake
KeyGenerator
;
import
io.shardingsphere.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration
;
import
org.junit.Test
;
...
...
@@ -55,7 +55,7 @@ public final class YamlTableRuleConfigurationTest {
result
.
setActualDataNodes
(
"ds_${0..1}.t_order_${0..1}"
);
result
.
setKeyGenerator
(
new
YamlKeyGeneratorConfiguration
());
result
.
getKeyGenerator
().
setColumn
(
"order_id"
);
result
.
getKeyGenerator
().
setClassName
(
Default
KeyGenerator
.
class
.
getName
());
result
.
getKeyGenerator
().
setClassName
(
Snowflake
KeyGenerator
.
class
.
getName
());
result
.
setLogicIndex
(
"order_index"
);
return
result
;
}
...
...
@@ -73,7 +73,7 @@ public final class YamlTableRuleConfigurationTest {
assertThat
(
actual
.
getLogicTable
(),
is
(
"t_order"
));
assertThat
(
actual
.
getActualDataNodes
(),
is
(
"ds_${0..1}.t_order_${0..1}"
));
assertThat
(
actual
.
getKeyGeneratorColumnName
(),
is
(
"order_id"
));
assertThat
(
actual
.
getKeyGenerator
(),
instanceOf
(
Default
KeyGenerator
.
class
));
assertThat
(
actual
.
getKeyGenerator
(),
instanceOf
(
Snowflake
KeyGenerator
.
class
));
assertThat
(
actual
.
getLogicIndex
(),
is
(
"order_index"
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录