Search in sources :

Example 6 with HintShardingStrategyConfiguration

use of io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.

the class ShardingRuleConfigurationConverterTest method assertFromJsonForHintStrategy.

@Test
public void assertFromJsonForHintStrategy() {
    ShardingRuleConfiguration actual = ShardingRuleConfigurationConverter.fromJson(getJsonForHintStrategy());
    assertCommon(actual);
    HintShardingStrategyConfiguration actualShardingStrategy = (HintShardingStrategyConfiguration) actual.getDefaultTableShardingStrategyConfig();
    assertThat(actualShardingStrategy.getShardingAlgorithm(), instanceOf(TestHintShardingAlgorithm.class));
}
Also used : ShardingRuleConfiguration(io.shardingjdbc.core.api.config.ShardingRuleConfiguration) HintShardingStrategyConfiguration(io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration) TestHintShardingAlgorithm(io.shardingjdbc.orchestration.internal.json.fixture.TestHintShardingAlgorithm) Test(org.junit.Test)

Example 7 with HintShardingStrategyConfiguration

use of io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.

the class ShardingRuleConfigurationConverterTest method assertToJsonForHintStrategy.

@Test
public void assertToJsonForHintStrategy() {
    HintShardingStrategyConfiguration actual = new HintShardingStrategyConfiguration(new TestHintShardingAlgorithm());
    assertThat(ShardingRuleConfigurationConverter.toJson(getCommonShardingRuleConfig(actual)), is(getJsonForHintStrategy()));
}
Also used : HintShardingStrategyConfiguration(io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration) TestHintShardingAlgorithm(io.shardingjdbc.orchestration.internal.json.fixture.TestHintShardingAlgorithm) Test(org.junit.Test)

Example 8 with HintShardingStrategyConfiguration

use of io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration in project sharding-jdbc by shardingjdbc.

the class ShardingNamespaceTest method assertHintStrategy.

@Test
public void assertHintStrategy() {
    HintShardingStrategyConfiguration hintStrategy = this.applicationContext.getBean("hintStrategy", HintShardingStrategyConfiguration.class);
    assertThat(hintStrategy.getShardingAlgorithm(), instanceOf(DefaultHintShardingAlgorithm.class));
}
Also used : DefaultHintShardingAlgorithm(io.shardingjdbc.spring.algorithm.DefaultHintShardingAlgorithm) HintShardingStrategyConfiguration(io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration) Test(org.junit.Test)

Aggregations

HintShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.HintShardingStrategyConfiguration)8 Test (org.junit.Test)4 ShardingRuleConfiguration (io.shardingjdbc.core.api.config.ShardingRuleConfiguration)3 ComplexShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.ComplexShardingStrategyConfiguration)2 InlineShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.InlineShardingStrategyConfiguration)2 NoneShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.NoneShardingStrategyConfiguration)2 StandardShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.StandardShardingStrategyConfiguration)2 ShardingRule (io.shardingjdbc.core.rule.ShardingRule)2 TestHintShardingAlgorithm (io.shardingjdbc.orchestration.internal.json.fixture.TestHintShardingAlgorithm)2 ShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.ShardingStrategyConfiguration)1 OrderDatabaseHintShardingAlgorithm (io.shardingjdbc.core.fixture.OrderDatabaseHintShardingAlgorithm)1 HintModuloDatabaseShardingAlgorithm (io.shardingjdbc.core.integrate.fixture.HintModuloDatabaseShardingAlgorithm)1 YamlComplexShardingStrategyConfiguration (io.shardingjdbc.core.yaml.sharding.strategy.YamlComplexShardingStrategyConfiguration)1 YamlHintShardingStrategyConfiguration (io.shardingjdbc.core.yaml.sharding.strategy.YamlHintShardingStrategyConfiguration)1 YamlInlineShardingStrategyConfiguration (io.shardingjdbc.core.yaml.sharding.strategy.YamlInlineShardingStrategyConfiguration)1 YamlNoneShardingStrategyConfiguration (io.shardingjdbc.core.yaml.sharding.strategy.YamlNoneShardingStrategyConfiguration)1 YamlStandardShardingStrategyConfiguration (io.shardingjdbc.core.yaml.sharding.strategy.YamlStandardShardingStrategyConfiguration)1 DefaultHintShardingAlgorithm (io.shardingjdbc.orchestration.spring.algorithm.DefaultHintShardingAlgorithm)1 DefaultHintShardingAlgorithm (io.shardingjdbc.spring.algorithm.DefaultHintShardingAlgorithm)1 Before (org.junit.Before)1