@Test public void testWarmUp() throws IOException { NetworkClient compositeClient = factory.getNetworkClient(); int numDiskNodesWarmedUp = 25; int numCloudNodesWarmedUp = 17; when(diskMocks.client.warmUpConnections(any(), anyInt(), anyLong(), any())).thenReturn(numDiskNodesWarmedUp); when(cloudMocks.client.warmUpConnections(any(), anyInt(), anyLong(), any())).thenReturn(numCloudNodesWarmedUp); List<DataNodeId> nodesToWarmUp = Collections.nCopies(3, mock(DataNodeId.class)); assertEquals("Unexpected number of connections warmed up", numDiskNodesWarmedUp + numCloudNodesWarmedUp, compositeClient.warmUpConnections(nodesToWarmUp, 100, 1000, Collections.emptyList())); verify(diskMocks.client).warmUpConnections(nodesToWarmUp, 100, 1000, Collections.emptyList()); verify(cloudMocks.client).warmUpConnections(nodesToWarmUp, 100, 1000, Collections.emptyList()); }
@Override public int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode, long timeForWarmUp, List<ResponseInfo> responseInfoList) { return childNetworkClients.values() .stream() .mapToInt(client -> client.warmUpConnections(dataNodeIds, connectionWarmUpPercentagePerDataNode, timeForWarmUp, responseInfoList)) .sum(); }
CompositeNetworkClient implements NetworkClient { @Override public int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode, long timeForWarmUp, List<ResponseInfo> responseInfoList) { return childNetworkClients.values() .stream() .mapToInt(client -> client.warmUpConnections(dataNodeIds, connectionWarmUpPercentagePerDataNode, timeForWarmUp, responseInfoList)) .sum(); } }
CompositeNetworkClient implements NetworkClient { @Override public int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode, long timeForWarmUp, List<ResponseInfo> responseInfoList) { return childNetworkClients.values() .stream() .mapToInt(client -> client.warmUpConnections(dataNodeIds, connectionWarmUpPercentagePerDataNode, timeForWarmUp, responseInfoList)) .sum(); } CompositeNetworkClient(EnumMap<ReplicaType, NetworkClient> childNetworkClients); }
CompositeNetworkClient implements NetworkClient { @Override public int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode, long timeForWarmUp, List<ResponseInfo> responseInfoList) { return childNetworkClients.values() .stream() .mapToInt(client -> client.warmUpConnections(dataNodeIds, connectionWarmUpPercentagePerDataNode, timeForWarmUp, responseInfoList)) .sum(); } CompositeNetworkClient(EnumMap<ReplicaType, NetworkClient> childNetworkClients); @Override List<ResponseInfo> sendAndPoll(List<RequestInfo> allRequestsToSend, Set<Integer> allRequestsToDrop,
      int pollTimeoutMs); @Override int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode,
      long timeForWarmUp, List<ResponseInfo> responseInfoList); @Override void wakeup(); @Override void close(); }
CompositeNetworkClient implements NetworkClient { @Override public int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode, long timeForWarmUp, List<ResponseInfo> responseInfoList) { return childNetworkClients.values() .stream() .mapToInt(client -> client.warmUpConnections(dataNodeIds, connectionWarmUpPercentagePerDataNode, timeForWarmUp, responseInfoList)) .sum(); } CompositeNetworkClient(EnumMap<ReplicaType, NetworkClient> childNetworkClients); @Override List<ResponseInfo> sendAndPoll(List<RequestInfo> allRequestsToSend, Set<Integer> allRequestsToDrop,
      int pollTimeoutMs); @Override int warmUpConnections(List<DataNodeId> dataNodeIds, int connectionWarmUpPercentagePerDataNode,
      long timeForWarmUp, List<ResponseInfo> responseInfoList); @Override void wakeup(); @Override void close();  }