String getRedirectLocation() { return s3obj.getRedirectLocation(); }
String getRedirectLocation() { return s3obj.getRedirectLocation(); }
@Override public String getRedirectLocation() { return wrapped.getRedirectLocation(); }
String getRedirectLocation() { return s3obj.getRedirectLocation(); }
String getRedirectLocation() { return s3obj.getRedirectLocation(); }
@Test public void testHandle() throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream("content".getBytes(StringUtils.UTF8)); HttpResponse response = new HttpResponse.Builder().content(bais) .header(Headers.REDIRECT_LOCATION, "redirect") .header(Headers.REQUESTER_CHARGED_HEADER, "true").build(); S3ObjectResponseHandler handler = new S3ObjectResponseHandler(); AmazonWebServiceResponse<S3Object> object = handler.handle(response); S3Object content = object.getResult(); assertEquals(content.getRedirectLocation(), "redirect"); assertTrue(content.isRequesterCharged()); S3ObjectInputStream is = content.getObjectContent(); int curr = -1; ByteArrayOutputStream baos = new ByteArrayOutputStream(); while ((curr = is.read()) != -1) { baos.write(curr); } assertArrayEquals(baos.toByteArray(), "content".getBytes(StringUtils.UTF8)); }