use of io.shardingjdbc.core.yaml.sharding.YamlShardingConfiguration in project sharding-jdbc by shardingjdbc.
the class SQLRewriteEngineTest method setUp.
@Before
public void setUp() throws IOException {
URL url = SQLRewriteEngineTest.class.getClassLoader().getResource("yaml/rewrite-rule.yaml");
Preconditions.checkNotNull(url, "Cannot found rewrite rule yaml configuration.");
YamlShardingConfiguration yamlShardingConfig = YamlShardingConfiguration.unmarshal(new File(url.getFile()));
shardingRule = yamlShardingConfig.getShardingRule(yamlShardingConfig.getDataSources().keySet());
selectStatement = new SelectStatement();
tableTokens = new HashMap<>(1, 1);
tableTokens.put("table_x", "table_1");
}
use of io.shardingjdbc.core.yaml.sharding.YamlShardingConfiguration in project sharding-jdbc by shardingjdbc.
the class AbstractBaseIntegrateSQLParsingTest method buildShardingRule.
private static ShardingRule buildShardingRule() throws IOException {
URL url = AbstractBaseIntegrateSQLParsingTest.class.getClassLoader().getResource("yaml/parser-rule.yaml");
Preconditions.checkNotNull(url, "Cannot found parser rule yaml configuration.");
YamlShardingConfiguration yamlShardingConfig = YamlShardingConfiguration.unmarshal(new File(url.getFile()));
return yamlShardingConfig.getShardingRule(yamlShardingConfig.getDataSources().keySet());
}
Aggregations