TableRule { public Optional<String> getGenerateKeyColumn() { return Optional.ofNullable(generateKeyColumn); } TableRule(final Collection<String> dataSourceNames, final String logicTableName);  TableRule(final ShardingTableRuleConfiguration tableRuleConfig, final Collection<String> dataSourceNames, 
                     final ShardingAlgorithm databaseShardingAlgorithm, final ShardingAlgorithm tableShardingAlgorithm, final String defaultGenerateKeyColumn);  TableRule(final ShardingAutoTableRuleConfiguration tableRuleConfig, 
                     final Collection<String> dataSourceNames, final ShardingAlgorithm shardingAlgorithm, final String defaultGenerateKeyColumn); Map<String, List<DataNode>> getDataNodeGroups(); Collection<String> getActualDatasourceNames(); Collection<String> getActualTableNames(final String targetDataSource); Optional<String> getGenerateKeyColumn();  }
@Test public void assertCreateFullTableRule() { ShardingTableRuleConfiguration tableRuleConfig = new ShardingTableRuleConfiguration("LOGIC_TABLE", "ds${0..1}.table_${0..2}"); tableRuleConfig.setDatabaseShardingStrategy(new NoneShardingStrategyConfiguration()); tableRuleConfig.setTableShardingStrategy(new NoneShardingStrategyConfiguration()); tableRuleConfig.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("col_1", "increment")); TableRule actual = new TableRule(tableRuleConfig, Arrays.asList("ds0", "ds1"), null, null, null); assertThat(actual.getLogicTable(), is("logic_table")); assertThat(actual.getActualDataNodes().size(), is(6)); assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", "table_0"))); assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", "table_1"))); assertTrue(actual.getActualDataNodes().contains(new DataNode("ds0", "table_2"))); assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", "table_0"))); assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", "table_1"))); assertTrue(actual.getActualDataNodes().contains(new DataNode("ds1", "table_2"))); assertNotNull(actual.getDatabaseShardingStrategy()); assertNotNull(actual.getTableShardingStrategy()); assertTrue(actual.getGenerateKeyColumn().isPresent()); assertThat(actual.getGenerateKeyColumn().get(), is("col_1")); assertThat(actual.getKeyGeneratorName(), is("increment")); }