提交 953bb754 编写于 作者: T tristaZero

modify import

上级 fffd717e
......@@ -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.DefaultKeyGenerator;
import io.shardingsphere.core.keygen.SnowflakeKeyGenerator;
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 DefaultKeyGenerator() : defaultKeyGenerator;
return null == defaultKeyGenerator ? new SnowflakeKeyGenerator() : defaultKeyGenerator;
}
private Collection<MasterSlaveRule> createMasterSlaveRules(final Collection<MasterSlaveRuleConfiguration> masterSlaveRuleConfigurations) {
......
......@@ -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.DefaultKeyGenerator;
import io.shardingsphere.core.keygen.SnowflakeKeyGenerator;
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(DefaultKeyGenerator.class));
assertThat(actual.getDefaultKeyGenerator(), instanceOf(SnowflakeKeyGenerator.class));
}
@Test
......
......@@ -18,7 +18,7 @@
package io.shardingsphere.core.yaml.sharding;
import io.shardingsphere.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithmType;
import io.shardingsphere.core.keygen.DefaultKeyGenerator;
import io.shardingsphere.core.keygen.SnowflakeKeyGenerator;
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(DefaultKeyGenerator.class.getName()));
assertThat(actual.getShardingRule().getTables().get("t_order").getKeyGenerator().getClassName(), is(SnowflakeKeyGenerator.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(DefaultKeyGenerator.class.getName()));
assertThat(actual.getShardingRule().getDefaultKeyGenerator().getKeyGenerator().getClass().getName(), is(SnowflakeKeyGenerator.class.getName()));
}
private void assertMasterSlaveRules(final YamlShardingConfiguration actual) {
......
......@@ -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.DefaultKeyGenerator;
import io.shardingsphere.core.keygen.SnowflakeKeyGenerator;
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(DefaultKeyGenerator.class.getName());
keyGeneratorConfiguration.setClassName(SnowflakeKeyGenerator.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(DefaultKeyGenerator.class));
assertThat(actual.getDefaultKeyGenerator(), instanceOf(SnowflakeKeyGenerator.class));
assertMasterSlaveRuleConfig(actual.getMasterSlaveRuleConfigs().iterator().next());
}
......
......@@ -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.DefaultKeyGenerator;
import io.shardingsphere.core.keygen.SnowflakeKeyGenerator;
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(DefaultKeyGenerator.class.getName());
result.getKeyGenerator().setClassName(SnowflakeKeyGenerator.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(DefaultKeyGenerator.class));
assertThat(actual.getKeyGenerator(), instanceOf(SnowflakeKeyGenerator.class));
assertThat(actual.getLogicIndex(), is("order_index"));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册