use of com.amazonaws.http.HttpResponse in project beam by apache.
the class AmazonKinesisMock method listShards.
@Override
public ListShardsResult listShards(ListShardsRequest listShardsRequest) {
if (expectedListShardsLimitExceededException) {
throw new LimitExceededException("ListShards rate limit exceeded");
}
ListShardsResult result = new ListShardsResult();
List<Shard> shards = IntStream.range(0, shardedData.size()).boxed().map(i -> new Shard().withShardId(Integer.toString(i))).collect(Collectors.toList());
result.setShards(shards);
HttpResponse response = new HttpResponse(null, null);
response.setStatusCode(200);
result.setSdkHttpMetadata(SdkHttpMetadata.from(response));
return result;
}
use of com.amazonaws.http.HttpResponse in project beam by apache.
the class PublishResultCodersTest method buildFullPublishResult.
private PublishResult buildFullPublishResult() {
PublishResult publishResult = new PublishResult().withMessageId(UUID.randomUUID().toString());
publishResult.setSdkResponseMetadata(new ResponseMetadata(ImmutableMap.of(ResponseMetadata.AWS_REQUEST_ID, UUID.randomUUID().toString())));
HttpResponse httpResponse = new HttpResponse(null, null);
httpResponse.setStatusCode(200);
httpResponse.addHeader("Content-Type", "application/json");
publishResult.setSdkHttpMetadata(SdkHttpMetadata.from(httpResponse));
return publishResult;
}
use of com.amazonaws.http.HttpResponse in project sandbox by irof.
the class AmazonHttpClientTest method sendRequest.
private void sendRequest(Supplier<AmazonHttpClient> client) {
Request<?> request = new DefaultRequest<>("test-service");
request.setEndpoint(server.getUri());
InputStream in = new ByteArrayInputStream("hoge".getBytes(StandardCharsets.UTF_8));
request.setContent(in);
client.get().execute(request, new HttpResponseHandler<AmazonWebServiceResponse<Object>>() {
@Override
public AmazonWebServiceResponse<Object> handle(HttpResponse response) throws Exception {
return new AmazonWebServiceResponse<>();
}
@Override
public boolean needsConnectionLeftOpen() {
return false;
}
}, new HttpResponseHandler<AmazonServiceException>() {
@Override
public AmazonServiceException handle(HttpResponse response) throws Exception {
return null;
}
@Override
public boolean needsConnectionLeftOpen() {
return false;
}
}, new ExecutionContext());
}
use of com.amazonaws.http.HttpResponse in project beam by apache.
the class AwsCodersTest method buildSdkHttpMetadata.
private SdkHttpMetadata buildSdkHttpMetadata() {
HttpResponse httpResponse = new HttpResponse(null, null);
httpResponse.setStatusCode(200);
httpResponse.addHeader("Content-Type", "application/json");
return SdkHttpMetadata.from(httpResponse);
}
Aggregations