AutoIntervalShardingAlgorithm implements StandardShardingAlgorithm<Comparable<?>>, ShardingAutoTableAlgorithm { @Override public void init() { dateTimeLower = getDateTime(DATE_TIME_LOWER_KEY); shardingSeconds = getShardingSeconds(); autoTablesAmount = (int) (Math.ceil(parseDate(props.getProperty(DATE_TIME_UPPER_KEY)) / shardingSeconds) + 2); }  @Override void init(); @Override String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Comparable<?>> shardingValue); @Override Collection<String> doSharding(final Collection<String> availableTargetNames, final RangeShardingValue<Comparable<?>> shardingValue); @Override String getType();  }
@Test public void assertGetAutoTablesAmount() { AutoIntervalShardingAlgorithm shardingAlgorithm = new AutoIntervalShardingAlgorithm(); shardingAlgorithm.getProps().setProperty("datetime-lower", "2020-01-01 00:00:00"); shardingAlgorithm.getProps().setProperty("datetime-upper", "2021-01-01 00:00:00"); shardingAlgorithm.getProps().setProperty("sharding-seconds", "86400"); shardingAlgorithm.init(); assertThat(shardingAlgorithm.getAutoTablesAmount(), is(368)); }