@Test public void cannotReadForWrongSweepStrategy() { assertThat(readThorough(shardCons)).isEmpty(); assertThat(readConservative(shardThor)).isEmpty(); }
@Test public void canReadNextTimestampWhenSweepTsIsLarge() { assertThat(readConservative(shardCons)).contains(TS_FINE_PARTITION); assertThat(readThorough(shardThor)).contains(TS2_FINE_PARTITION); }
@Test public void cannotReadForWrongShard() { assertThat(readConservative(shardCons + 1)).isEmpty(); assertThat(readThorough(shardThor + 1)).isEmpty(); }
@Test public void canReadNextIfNotProgressedBeyondForThorough() { progress.updateLastSweptTimestamp(thorough(shardThor), TS2 - 1); assertThat(readThorough(shardThor)).contains(TS2_FINE_PARTITION); }
@Test public void noNextTimestampWhenImmutableTsInSmallerPartitionForEitherSweepStrategy() { immutableTs = TS - TS_FINE_GRANULARITY; assertThat(tsPartitionFine(immutableTs)).isLessThan(TS_FINE_PARTITION); assertThat(readConservative(shardCons)).isEmpty(); assertThat(tsPartitionFine(immutableTs)).isLessThan(TS2_FINE_PARTITION); assertThat(readThorough(shardThor)).isEmpty(); }
@Test public void noNextTimestampWhenUnreadableTsInSmallerPartitionForConservativeOnly() { unreadableTs = TS - TS_FINE_GRANULARITY; assertThat(tsPartitionFine(unreadableTs)).isLessThan(TS_FINE_PARTITION); assertThat(readConservative(shardCons)).isEmpty(); assertThat(tsPartitionFine(unreadableTs)).isLessThan(TS2_FINE_PARTITION); assertThat(readThorough(shardThor)).contains(TS2_FINE_PARTITION); }
@Test public void canReadNextTimestampIfProgressedBeyondButInSamePartitionForForThorough() { progress.updateLastSweptTimestamp(thorough(shardThor), maxTsForFinePartition(TS2_FINE_PARTITION) - 1); assertThat(readThorough(shardThor)).contains(TS2_FINE_PARTITION); }
@Test public void noNextTimestampIfProgressedToEndOfPartitionForThorough() { progress.updateLastSweptTimestamp(thorough(shardThor), maxTsForFinePartition(TS2_FINE_PARTITION)); assertThat(readThorough(shardThor)).isEmpty(); }
@Test public void canReadNextWhenOtherShardsAndStrategiesProgressToEndOfPartitionForThorough() { progress.updateLastSweptTimestamp(thorough(shardCons), maxTsForFinePartition(TS2_FINE_PARTITION)); progress.updateLastSweptTimestamp(conservative(shardThor), maxTsForFinePartition(TS2_FINE_PARTITION)); progress.updateLastSweptTimestamp(conservative(shardCons), maxTsForFinePartition(TS2_FINE_PARTITION)); assertThat(readThorough(shardThor)).contains(TS2_FINE_PARTITION); }