use of com.github.ambry.rest.RestResponseChannel in project ambry by linkedin.
the class TtlUpdateHandlerTest method verifyTtlUpdate.
// handleGoodCaseTest()
/**
* Verifies that the TTL of the blob is updated
* @param restRequest the {@link RestRequest} to get a signed URL.
* @param expectedAccount the {@link Account} that should be populated in {@link RestRequest}.
* @param expectedContainer the {@link Container} that should be populated in {@link RestRequest}.
* @throws Exception
*/
private void verifyTtlUpdate(RestRequest restRequest, Account expectedAccount, Container expectedContainer) throws Exception {
assertTtl(TTL_SECS);
RestResponseChannel restResponseChannel = new MockRestResponseChannel();
sendRequestGetResponse(restRequest, restResponseChannel);
assertEquals("ResponseStatus not as expected", ResponseStatus.Ok, restResponseChannel.getStatus());
assertNotNull("Date has not been set", restResponseChannel.getHeader(RestUtils.Headers.DATE));
assertEquals("Content-length is not as expected", 0, Integer.parseInt((String) restResponseChannel.getHeader(RestUtils.Headers.CONTENT_LENGTH)));
assertEquals("Account not as expected", expectedAccount, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_ACCOUNT_KEY));
assertEquals("Container not as expected", expectedContainer, restRequest.getArgs().get(RestUtils.InternalKeys.TARGET_CONTAINER_KEY));
assertTtl(Utils.Infinite_Time);
}
Aggregations