hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/web/client/TestVolume.java
private static List<CloseableHttpClient> mockHttpClients(
      OzoneRestClient mockedClient)
      throws IOException {
    List<CloseableHttpClient> spyHttpClients = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
      CloseableHttpClient spyHttpClient = Mockito
          .spy(HddsClientUtils.newHttpClient());
      spyHttpClients.add(spyHttpClient);
    }

    List<CloseableHttpClient> nextReturns =
        new ArrayList<>(spyHttpClients.subList(1, spyHttpClients.size()));
    Mockito.when(mockedClient.newHttpClient()).thenReturn(
        spyHttpClients.get(0),
        nextReturns.toArray(new CloseableHttpClient[nextReturns.size()]));
    return spyHttpClients;
  }
/**
   * Returns a list of mocked {@link CloseableHttpClient} used for testing.
   * The mocked client replaces the actual calls in
   * {@link OzoneRestClient#newHttpClient()}, it is used to verify
   * if the invocation of this client is expected. <b>Note</b>, the output
   * of this method is always used as the input of
   * {@link TestVolume#verifyHttpConnectionClosed(List)}.
   *
   * @param mockedClient mocked ozone client.
   * @return a list of mocked {@link CloseableHttpClient}.
   * @throws IOException
   */
Returns a list of mocked  CloseableHttpClient used for testing.
The mocked client replaces the actual calls in
OzoneRestClient#newHttpClient(), it is used to verify
if the invocation of this client is expected. Note, the output
of this method is always used as the input of
TestVolume#verifyHttpConnectionClosed(List).

@param mockedClient mocked ozone client.
@return a list of mocked  CloseableHttpClient.
Returns a list of mocked CloseableHttpClient used for testing . The mocked client replaces the actual calls in OzoneRestClient#newHttpClient () it is used to verify if the invocation of this client is expected . Note the output of this method is always used as the input of TestVolume#verifyHttpConnectionClosed ( List ) . @param mockedClient mocked ozone client . @return a list of mocked CloseableHttpClient .
private static List<CloseableHttpClient> mockHttpClients(
      OzoneRestClient mockedClient)
      throws IOException {
    List<CloseableHttpClient> spyHttpClients = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
      CloseableHttpClient spyHttpClient = Mockito
          .spy(HddsClientUtils.newHttpClient());
      spyHttpClients.add(spyHttpClient);
    }
    List<CloseableHttpClient> nextReturns =
        new ArrayList<>(spyHttpClients.subList(1, spyHttpClients.size()));
    Mockito.when(mockedClient.newHttpClient()).thenReturn(
        spyHttpClients.get(0),
        nextReturns.toArray(new CloseableHttpClient[nextReturns.size()]));
    return spyHttpClients;
  }
private static List < CloseableHttpClient > mockHttpClients ( OzoneRestClient mockedClient ) throws IOException { List < CloseableHttpClient > spyHttpClients = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { CloseableHttpClient spyHttpClient = Mockito . spy ( HddsClientUtils . newHttpClient ( ) ) ; spyHttpClients . add ( spyHttpClient ) ; } List < CloseableHttpClient > nextReturns = new ArrayList < > ( spyHttpClients . subList ( 1 , spyHttpClients . size ( ) ) ) ; Mockito . when ( mockedClient . newHttpClient ( ) ) . thenReturn ( spyHttpClients . get ( 0 ) , nextReturns . toArray ( new CloseableHttpClient [ nextReturns . size ( ) ] ) ) ; return spyHttpClients ; }
Returns a list of mocked {@link CloseableHttpClient} used for testing.
Returns a list of mocked { @link CloseableHttpClient } used for testing .