use of io.reactiverse.awssdk.reactivestreams.ReadStreamPublisher in project aws-sdk by reactiverse.
the class VertxS3ClientSpec method publishImageToBucket.
@Test
@Order(3)
void publishImageToBucket(Vertx vertx, VertxTestContext ctx) throws Exception {
final Context originalContext = vertx.getOrCreateContext();
final S3AsyncClient s3 = s3(originalContext);
readFileFromDisk(vertx).flatMap(file -> {
final AsyncRequestBody body = AsyncRequestBody.fromPublisher(new ReadStreamPublisher<>(file.getDelegate()));
return single(s3.putObject(VertxS3ClientSpec::uploadImgReq, body));
}).subscribe(putFileRes -> {
assertContext(vertx, originalContext, ctx);
ctx.verify(() -> {
assertNotNull(putFileRes.eTag());
ctx.completeNow();
});
}, ctx::failNow);
}
Aggregations