@Test public void initializeResourceLeaderMapHandlesOneResource() { final ResourceId id1 = new ResourceId("test-resource-one"); final Map<ResourceId, LeaderId> resourceIdLeaderIdMap = StandardLeaderElector.initializeResourceLeaderMap(Lists.list(id1)); assertThat(resourceIdLeaderIdMap).hasSize(1); assertThat(resourceIdLeaderIdMap).containsEntry(id1, LeaderId.UNKNOWN); }
static Map<ResourceId, LeaderId> initializeResourceLeaderMap(Collection<ResourceId> ids) { return ids.stream().collect(Collectors.toMap(Function.identity(), s -> LeaderId.UNKNOWN)); }
StandardLeaderElector implements LeaderElector, LeaderStatus { static Map<ResourceId, LeaderId> initializeResourceLeaderMap(Collection<ResourceId> ids) { return ids.stream().collect(Collectors.toMap(Function.identity(), s -> LeaderId.UNKNOWN)); } }
StandardLeaderElector implements LeaderElector, LeaderStatus { static Map<ResourceId, LeaderId> initializeResourceLeaderMap(Collection<ResourceId> ids) { return ids.stream().collect(Collectors.toMap(Function.identity(), s -> LeaderId.UNKNOWN)); } @Inject  StandardLeaderElector(LeaderDatabase leaderDatabase, Config config, Registry registry);  StandardLeaderElector(
      LeaderId leaderId,
      LeaderDatabase leaderDatabase,
      Config config,
      Registry registry,
      Map<ResourceId, LeaderId> resourceLeaders,
      Id leaderRemovalsCounterId,
      Id resourceLeaderGaugeId,
      Id resourceWithNoLeaderGaugeId
  ); }
StandardLeaderElector implements LeaderElector, LeaderStatus { static Map<ResourceId, LeaderId> initializeResourceLeaderMap(Collection<ResourceId> ids) { return ids.stream().collect(Collectors.toMap(Function.identity(), s -> LeaderId.UNKNOWN)); } @Inject  StandardLeaderElector(LeaderDatabase leaderDatabase, Config config, Registry registry);  StandardLeaderElector(
      LeaderId leaderId,
      LeaderDatabase leaderDatabase,
      Config config,
      Registry registry,
      Map<ResourceId, LeaderId> resourceLeaders,
      Id leaderRemovalsCounterId,
      Id resourceLeaderGaugeId,
      Id resourceWithNoLeaderGaugeId
  ); @Override boolean addResource(ResourceId resourceId); @Override LeaderId getLeaderFor(ResourceId resourceId); @Override Set<ResourceId> getResources(); @Override void initialize(); @Override boolean removeLeaderFor(ResourceId resourceId); @Override boolean removeResource(ResourceId resourceId); @Override void runElection(); @Override boolean hasLeadership(); @Override boolean hasLeadershipFor(ResourceId resourceId); }
StandardLeaderElector implements LeaderElector, LeaderStatus { static Map<ResourceId, LeaderId> initializeResourceLeaderMap(Collection<ResourceId> ids) { return ids.stream().collect(Collectors.toMap(Function.identity(), s -> LeaderId.UNKNOWN)); } @Inject  StandardLeaderElector(LeaderDatabase leaderDatabase, Config config, Registry registry);  StandardLeaderElector(
      LeaderId leaderId,
      LeaderDatabase leaderDatabase,
      Config config,
      Registry registry,
      Map<ResourceId, LeaderId> resourceLeaders,
      Id leaderRemovalsCounterId,
      Id resourceLeaderGaugeId,
      Id resourceWithNoLeaderGaugeId
  ); @Override boolean addResource(ResourceId resourceId); @Override LeaderId getLeaderFor(ResourceId resourceId); @Override Set<ResourceId> getResources(); @Override void initialize(); @Override boolean removeLeaderFor(ResourceId resourceId); @Override boolean removeResource(ResourceId resourceId); @Override void runElection(); @Override boolean hasLeadership(); @Override boolean hasLeadershipFor(ResourceId resourceId);  }