### Question:
ShardOrganizationManager { @VisibleForTesting static Set<OrganizationSet> createOrganizationSets(Table tableInfo, Collection<ShardIndexInfo> shards) { return getShardsByDaysBuckets(tableInfo, shards).stream() .map(indexInfos -> getOverlappingOrganizationSets(tableInfo, indexInfos)) .flatMap(Collection::stream) .collect(toSet()); } @Inject  ShardOrganizationManager(
            @ForMetadata IDBI dbi,
            NodeManager nodeManager,
            ShardManager shardManager,
            ShardOrganizer organizer,
            StorageManagerConfig config);  ShardOrganizationManager(
            IDBI dbi,
            String currentNodeIdentifier,
            ShardManager shardManager,
            ShardOrganizer organizer,
            boolean enabled,
            Duration organizationInterval,
            Duration organizationDiscoveryInterval); @PostConstruct void start(); @PreDestroy void shutdown();  }### Answer:
@Test public void testSimple() { long timestamp = 1L; int day = 1; List<ShardIndexInfo> shards = ImmutableList.of( shardWithSortRange(1, ShardRange.of(new Tuple(types, 5L, "hello", day, timestamp), new Tuple(types, 10L, "hello", day, timestamp))), shardWithSortRange(1, ShardRange.of(new Tuple(types, 7L, "hello", day, timestamp), new Tuple(types, 10L, "hello", day, timestamp))), shardWithSortRange(1, ShardRange.of(new Tuple(types, 6L, "hello", day, timestamp), new Tuple(types, 9L, "hello", day, timestamp))), shardWithSortRange(1, ShardRange.of(new Tuple(types, 1L, "hello", day, timestamp), new Tuple(types, 5L, "hello", day, timestamp)))); Set<OrganizationSet> actual = createOrganizationSets(tableInfo, shards); assertEquals(actual.size(), 1); assertEquals(getOnlyElement(actual).getShards(), extractIndexes(shards, 0, 1, 2)); }
@Test public void testSimpleTemporal() { List<Type> temporalType = ImmutableList.of(DATE); List<Type> types = ImmutableList.of(BIGINT); int day1 = 1; int day2 = 2; int day4 = 4; int day5 = 5; List<ShardIndexInfo> shards = ImmutableList.of( shardWithTemporalRange(1, ShardRange.of(new Tuple(types, 5L), new Tuple(types, 10L)), ShardRange.of(new Tuple(temporalType, day1), new Tuple(temporalType, day2))), shardWithTemporalRange(1, ShardRange.of(new Tuple(types, 7L), new Tuple(types, 10L)), ShardRange.of(new Tuple(temporalType, day4), new Tuple(temporalType, day5))), shardWithTemporalRange(1, ShardRange.of(new Tuple(types, 6L), new Tuple(types, 9L)), ShardRange.of(new Tuple(temporalType, day1), new Tuple(temporalType, day2))), shardWithTemporalRange(1, ShardRange.of(new Tuple(types, 4L), new Tuple(types, 8L)), ShardRange.of(new Tuple(temporalType, day4), new Tuple(temporalType, day5)))); Set<OrganizationSet> organizationSets = createOrganizationSets(temporalTableInfo, shards); Set<Set<UUID>> actual = organizationSets.stream() .map(OrganizationSet::getShards) .collect(toSet()); assertEquals(organizationSets.size(), 2); assertEquals(actual, ImmutableSet.of(extractIndexes(shards, 0, 2), extractIndexes(shards, 1, 3))); }