Search in sources :

Example 6 with S3MetaRequest

use of software.amazon.awssdk.crt.s3.S3MetaRequest in project aws-sdk-java-v2 by aws.

the class S3CrtAsyncHttpClientTest method cancelRequest_shouldForwardCancellation.

@Test
public void cancelRequest_shouldForwardCancellation() {
    AsyncExecuteRequest asyncExecuteRequest = getExecuteRequestBuilder().build();
    S3MetaRequest metaRequest = Mockito.mock(S3MetaRequest.class);
    when(s3Client.makeMetaRequest(any(S3MetaRequestOptions.class))).thenReturn(metaRequest);
    CompletableFuture<Void> future = asyncHttpClient.execute(asyncExecuteRequest);
    future.cancel(false);
    verify(metaRequest).cancel();
}
Also used : AsyncExecuteRequest(software.amazon.awssdk.http.async.AsyncExecuteRequest) S3MetaRequestOptions(software.amazon.awssdk.crt.s3.S3MetaRequestOptions) S3MetaRequest(software.amazon.awssdk.crt.s3.S3MetaRequest) Test(org.junit.Test)

Example 7 with S3MetaRequest

use of software.amazon.awssdk.crt.s3.S3MetaRequest in project aws-sdk-java-v2 by aws.

the class S3CrtAsyncHttpClientTest method cancelRequest_shouldForwardCancellation.

@Test
public void cancelRequest_shouldForwardCancellation() {
    AsyncExecuteRequest asyncExecuteRequest = getExecuteRequestBuilder().build();
    S3MetaRequest metaRequest = Mockito.mock(S3MetaRequest.class);
    when(s3Client.makeMetaRequest(any(S3MetaRequestOptions.class))).thenReturn(metaRequest);
    CompletableFuture<Void> future = asyncHttpClient.execute(asyncExecuteRequest);
    future.cancel(false);
    verify(metaRequest).cancel();
}
Also used : AsyncExecuteRequest(software.amazon.awssdk.http.async.AsyncExecuteRequest) S3MetaRequestOptions(software.amazon.awssdk.crt.s3.S3MetaRequestOptions) S3MetaRequest(software.amazon.awssdk.crt.s3.S3MetaRequest) Test(org.junit.Test)

Aggregations

HttpRequest (software.amazon.awssdk.crt.http.HttpRequest)5 S3MetaRequest (software.amazon.awssdk.crt.s3.S3MetaRequest)4 S3MetaRequestOptions (software.amazon.awssdk.crt.s3.S3MetaRequestOptions)4 ByteBuffer (java.nio.ByteBuffer)3 Test (org.junit.Test)3 HttpHeader (software.amazon.awssdk.crt.http.HttpHeader)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 String (java.lang.String)2 URI (java.net.URI)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 HttpRequestBodyStream (software.amazon.awssdk.crt.http.HttpRequestBodyStream)2 CrtS3RuntimeException (software.amazon.awssdk.crt.s3.CrtS3RuntimeException)2 SdkHttpRequest (software.amazon.awssdk.http.SdkHttpRequest)2 AsyncExecuteRequest (software.amazon.awssdk.http.async.AsyncExecuteRequest)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintWriter (java.io.PrintWriter)1 BufferOverflowException (java.nio.BufferOverflowException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Duration (java.time.Duration)1