FrontendIntegrationTest.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:ambry 作者:
/**
 * Gets the blob info of the blob with blob ID {@code blobId} and verifies them against what is expected.
 * @param blobId the blob ID of the blob to HEAD.
 * @param getOption the options to use while getting the blob.
 * @param expectedHeaders the expected headers in the response.
 * @param isPrivate {@code true} if the blob is expected to be private
 * @param accountName the expected account name in the response.
 * @param containerName the expected container name in response.
 * @param usermetadata if non-null, this is expected to come as the body.
 * @throws ExecutionException
 * @throws InterruptedException
 */
private void getBlobInfoAndVerify(String blobId, GetOption getOption, HttpHeaders expectedHeaders, boolean isPrivate,
    String accountName, String containerName, byte[] usermetadata) throws ExecutionException, InterruptedException {
  HttpHeaders headers = new DefaultHttpHeaders();
  if (getOption != null) {
    headers.add(RestUtils.Headers.GET_OPTION, getOption.toString());
  }
  FullHttpRequest httpRequest =
      buildRequest(HttpMethod.GET, blobId + "/" + RestUtils.SubResource.BlobInfo, headers, null);
  ResponseParts responseParts = nettyClient.sendRequest(httpRequest, null, null).get();
  HttpResponse response = getHttpResponse(responseParts);
  assertEquals("Unexpected response status", HttpResponseStatus.OK, response.status());
  checkCommonGetHeadHeaders(response.headers());
  verifyBlobProperties(expectedHeaders, isPrivate, response);
  verifyAccountAndContainerHeaders(accountName, containerName, response);
  verifyUserMetadata(expectedHeaders, response, usermetadata, responseParts.queue);
  assertTrue("Channel should be active", HttpUtil.isKeepAlive(response));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号