@Test public void testDetermineNewLeasesToCreate0Leases0ReshardsForMultiStream() { final String shardId0 = "shardId-0"; final String shardId1 = "shardId-1"; final SequenceNumberRange sequenceRange = ShardObjectHelper.newSequenceNumberRange("342980", null); final List<Shard> shards = Arrays.asList(ShardObjectHelper.newShard(shardId0, null, null, sequenceRange), ShardObjectHelper.newShard(shardId1, null, null, sequenceRange)); final List<Lease> currentLeases = Collections.emptyList(); final HierarchicalShardSyncer.LeaseSynchronizer emptyLeaseTableSynchronizer = new HierarchicalShardSyncer.EmptyLeaseTableSynchronizer(); final List<Lease> newLeases = HierarchicalShardSyncer.determineNewLeasesToCreate(emptyLeaseTableSynchronizer, shards, currentLeases, INITIAL_POSITION_LATEST, new HashSet<>(), MULTI_STREAM_ARGS); validateHashRangeinLease(newLeases); final Set<String> newLeaseKeys = newLeases.stream().map(Lease::leaseKey).collect(Collectors.toSet()); final Set<String> expectedLeaseIds = new HashSet<>( toMultiStreamLeaseList(Arrays.asList(shardId0, shardId1))); assertThat(newLeases.size(), equalTo(expectedLeaseIds.size())); assertThat(newLeaseKeys, equalTo(expectedLeaseIds)); }
static List<Lease> determineNewLeasesToCreate(final LeaseSynchronizer leaseSynchronizer, final List<Shard> shards, final List<Lease> currentLeases, final InitialPositionInStreamExtended initialPosition, final Set<String> inconsistentShardIds, final MultiStreamArgs multiStreamArgs) { return leaseSynchronizer.determineNewLeasesToCreate(shards, currentLeases, initialPosition, inconsistentShardIds, multiStreamArgs); }
HierarchicalShardSyncer { static List<Lease> determineNewLeasesToCreate(final LeaseSynchronizer leaseSynchronizer, final List<Shard> shards, final List<Lease> currentLeases, final InitialPositionInStreamExtended initialPosition, final Set<String> inconsistentShardIds, final MultiStreamArgs multiStreamArgs) { return leaseSynchronizer.determineNewLeasesToCreate(shards, currentLeases, initialPosition, inconsistentShardIds, multiStreamArgs); } }
HierarchicalShardSyncer { static List<Lease> determineNewLeasesToCreate(final LeaseSynchronizer leaseSynchronizer, final List<Shard> shards, final List<Lease> currentLeases, final InitialPositionInStreamExtended initialPosition, final Set<String> inconsistentShardIds, final MultiStreamArgs multiStreamArgs) { return leaseSynchronizer.determineNewLeasesToCreate(shards, currentLeases, initialPosition, inconsistentShardIds, multiStreamArgs); } HierarchicalShardSyncer();  HierarchicalShardSyncer(final boolean isMultiStreamMode, final String streamIdentifier); }
HierarchicalShardSyncer { static List<Lease> determineNewLeasesToCreate(final LeaseSynchronizer leaseSynchronizer, final List<Shard> shards, final List<Lease> currentLeases, final InitialPositionInStreamExtended initialPosition, final Set<String> inconsistentShardIds, final MultiStreamArgs multiStreamArgs) { return leaseSynchronizer.determineNewLeasesToCreate(shards, currentLeases, initialPosition, inconsistentShardIds, multiStreamArgs); } HierarchicalShardSyncer();  HierarchicalShardSyncer(final boolean isMultiStreamMode, final String streamIdentifier); synchronized boolean checkAndCreateLeaseForNewShards(@NonNull final ShardDetector shardDetector,
            final LeaseRefresher leaseRefresher, final InitialPositionInStreamExtended initialPosition,
            final MetricsScope scope, final boolean ignoreUnexpectedChildShards, final boolean isLeaseTableEmpty); synchronized boolean checkAndCreateLeaseForNewShards(@NonNull final ShardDetector shardDetector,
            final LeaseRefresher leaseRefresher, final InitialPositionInStreamExtended initialPosition,
            List<Shard> latestShards, final boolean ignoreUnexpectedChildShards, final MetricsScope scope, final boolean isLeaseTableEmpty); synchronized Lease createLeaseForChildShard(final ChildShard childShard, final StreamIdentifier streamIdentifier); }
HierarchicalShardSyncer { static List<Lease> determineNewLeasesToCreate(final LeaseSynchronizer leaseSynchronizer, final List<Shard> shards, final List<Lease> currentLeases, final InitialPositionInStreamExtended initialPosition, final Set<String> inconsistentShardIds, final MultiStreamArgs multiStreamArgs) { return leaseSynchronizer.determineNewLeasesToCreate(shards, currentLeases, initialPosition, inconsistentShardIds, multiStreamArgs); } HierarchicalShardSyncer();  HierarchicalShardSyncer(final boolean isMultiStreamMode, final String streamIdentifier); synchronized boolean checkAndCreateLeaseForNewShards(@NonNull final ShardDetector shardDetector,
            final LeaseRefresher leaseRefresher, final InitialPositionInStreamExtended initialPosition,
            final MetricsScope scope, final boolean ignoreUnexpectedChildShards, final boolean isLeaseTableEmpty); synchronized boolean checkAndCreateLeaseForNewShards(@NonNull final ShardDetector shardDetector,
            final LeaseRefresher leaseRefresher, final InitialPositionInStreamExtended initialPosition,
            List<Shard> latestShards, final boolean ignoreUnexpectedChildShards, final MetricsScope scope, final boolean isLeaseTableEmpty); synchronized Lease createLeaseForChildShard(final ChildShard childShard, final StreamIdentifier streamIdentifier);  }