zhfeng commented on a change in pull request #3077: URL: https://github.com/apache/camel-quarkus/pull/3077#discussion_r704936169
########## File path: integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/Aws2S3Resource.java ########## @@ -97,18 +123,152 @@ public Response read(@PathParam("key") String key) throws Exception { @Path("s3/object-keys") @GET @Produces(MediaType.APPLICATION_JSON) - public List<String> objectKey() throws Exception { + public List<String> objectKey(@QueryParam("bucket") String bucket) throws Exception { + if (bucket == null) { + bucket = bucketName; + } + final List<S3Object> objects = (List<S3Object>) producerTemplate.requestBody( - componentUri(AWS2S3Operations.listObjects), + componentUri(bucket, AWS2S3Operations.listObjects) + "&autoCreateBucket=true", null, List.class); return objects.stream().map(S3Object::key).collect(Collectors.toList()); } - private String componentUri(final AWS2S3Operations operation) { + @Path("s3/upload") + @POST + @Consumes(MediaType.MULTIPART_FORM_DATA) + @Produces(MediaType.TEXT_PLAIN) + public String multipartUpload(@MultipartForm MultipartFormDataInput input) throws Exception { + + Map<String, List<InputPart>> formDataMap = input.getFormDataMap(); + String fileName = formDataMap.get("fileName").get(0).getBodyAsString(); + + if (fileName == null) { + throw new FileNotFoundException(); + } + + File file = File.createTempFile("aws2-", ".tmp"); + + List<InputPart> inputParts = formDataMap.get("file"); + for (InputPart inputPart : inputParts) { + InputStream inputStream = inputPart.getBody(InputStream.class, null); + Files.copy(inputStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING); Review comment: This test is migrated from the camel one ```S3MultipartUploadOperationIT.java``` which runs a test to upload a file. I just check the S3 MultipartUpload operation in camel-aws2-s3 component. It looks like that it splits a file content into pieces by partSize. Then upload them in S3 in one request. I think this mulitpart upload does not like the HTTP_MULTIPART_FORM. Anyway, I'm not an expert of AWS S3 so it mghit be some misunderstanding here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org