private void createServerSet() {
    servers = new ArrayList<>();
    serverSet = new HashSet<>();
    for (int i = 0; i < SERVER_COUNT; i++) {
      InetSocketAddress server = new InetSocketAddress("192.168.1." + i, 256);
      servers.add(server);
      serverSet.add(server);
    }

    when(housekeeperServerSet.getServers()).thenReturn(serverSet);
    when(chairmanServerSet.getServers()).thenReturn(serverSet);
    when(rootSchedulerServerSet.getServers()).thenReturn(serverSet);
    when(deployerServerSet.getServers()).thenReturn(serverSet);
    when(cloudStoreServerSet.getServers()).thenReturn(serverSet);
  }
  @Test
  public void testPartialErrorWithDifferentNumOfInstances() throws Throwable {
    Status readyStatus = new Status(StatusType.READY);
    setMessageAndStats(readyStatus);
    Status initializingStatus = new Status(StatusType.INITIALIZING);
    setMessageAndStats(initializingStatus);
    Status errorStatus = new Status(StatusType.ERROR);
    setMessageAndStats(errorStatus);

    when(chairmanServerSet.getServers()).thenReturn(singleInstanceServerSets.get(0).getServers());
    when(rootSchedulerServerSet.getServers())
        .thenReturn(singleInstanceServerSets.get(1).getServers());

    mockAllClientsToReturnSameStatus(readyStatus);

    when(housekeeperClients.get(0).getStatus()).thenReturn(readyStatus);
    when(housekeeperClients.get(1).getStatus()).thenReturn(initializingStatus);
    when(housekeeperClients.get(2).getStatus()).thenReturn(errorStatus);

    SystemStatus systemStatus = client.getSystemStatus();
    assertThat(systemStatus.getComponents().size(), is(statusConfig.getComponents().size()));
    assertThat(systemStatus.getStatus(), is(StatusType.PARTIAL_ERROR));

    List<ComponentStatus> compStatuses = systemStatus.getComponents();

    for (ComponentStatus status : compStatuses) {
      if (status.getComponent().equals(Component.HOUSEKEEPER)) {
        assertThat(status.getStatus(), is(StatusType.PARTIAL_ERROR));
        assertThat(status.getStats().get(StatusType.READY.toString()), is("1"));
        assertThat(status.getStats().get(StatusType.INITIALIZING.toString()), is("1"));
        assertThat(status.getStats().get(StatusType.ERROR.toString()), is("1"));
      } else if (status.getComponent().equals(Component.CHAIRMAN)
          || status.getComponent().equals(Component.ROOT_SCHEDULER)) {
        assertThat(status.getStatus(), is(StatusType.READY));
        assertThat(status.getStats().get(StatusType.READY.toString()), is("1"));
      } else {
        assertThat(status.getStatus(), is(StatusType.READY));
        assertThat(status.getStats().get(StatusType.READY.toString()), is("3"));
      }
    }
  }
  @Test
  public void testEmptyServerSet() throws Throwable {
    Status readyStatus = new Status(StatusType.READY);
    setMessageAndStats(readyStatus);
    when(deployerServerSet.getServers()).thenReturn(new HashSet<>());

    mockAllClientsToReturnSameStatus(readyStatus);

    SystemStatus systemStatus = client.getSystemStatus();

    assertThat(systemStatus.getComponents().size(), is(5));
    assertThat(systemStatus.getStatus(), is(StatusType.ERROR));

    ComponentStatus deployerComponent =
        systemStatus
            .getComponents()
            .stream()
            .filter(c -> Component.DEPLOYER.equals(c.getComponent()))
            .findFirst()
            .get();
    assertThat(deployerComponent, notNullValue());
    assertThat(deployerComponent.getStatus(), is(StatusType.UNREACHABLE));
    assertThat(deployerComponent.getMessage(), is("Empty ServerSet"));
  }