Skip to content

Commit

Permalink
feature(s3-connector): corrections 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-vandaele committed Dec 18, 2024
1 parent ecc2b88 commit 058a8c3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"name" : "AWS S3 Outbound Connector",
"id" : "io.camunda.connectors.aws.s3.v1",
"description" : "Execute S3 requests",
"metadata" : {
"keywords" : [ ]
},
"documentationRef" : "https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/aws-s3/",
"version" : 1,
"category" : {
Expand Down Expand Up @@ -143,10 +146,10 @@
},
"type" : "Dropdown",
"choices" : [ {
"name" : "Delete document",
"name" : "Delete object",
"value" : "deleteObject"
}, {
"name" : "Download document",
"name" : "Download object",
"value" : "downloadObject"
}, {
"name" : "Upload object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"name" : "Hybrid AWS S3 Outbound Connector",
"id" : "io.camunda.connectors.aws.s3.v1-hybrid",
"description" : "Execute S3 requests",
"metadata" : {
"keywords" : [ ]
},
"documentationRef" : "https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/aws-s3/",
"version" : 1,
"category" : {
Expand Down Expand Up @@ -148,10 +151,10 @@
},
"type" : "Dropdown",
"choices" : [ {
"name" : "Delete document",
"name" : "Delete object",
"value" : "deleteObject"
}, {
"name" : "Download document",
"name" : "Download object",
"value" : "downloadObject"
}, {
"name" : "Upload object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ private DownloadResponse retrieveResponseWithContent(

private DeleteResponse delete(DeleteObject deleteObject) {
DeleteObjectRequest deleteObjectRequest =
DeleteObjectRequest.builder()
.bucket(deleteObject.bucket())
.key(deleteObject.key())
.build();
DeleteObjectRequest.builder().bucket(deleteObject.bucket()).key(deleteObject.key()).build();

this.s3Client.deleteObject(deleteObjectRequest);
return new DeleteResponse(deleteObject.bucket(), deleteObject.key());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.JsonNode;
import io.camunda.connector.aws.s3.model.request.DeleteObject;
import io.camunda.connector.aws.s3.model.request.DownloadObject;
import io.camunda.connector.aws.s3.model.request.S3Action;
Expand Down Expand Up @@ -106,7 +106,8 @@ void executeDownloadAsTextContentAction() throws IOException {
assertInstanceOf(DownloadResponse.class, object);
assertNotNull(((DownloadResponse) object).element());
assertInstanceOf(Element.StringContent.class, ((DownloadResponse) object).element());
assertEquals("Hello World", ((DownloadResponse) object).element());
assertEquals(
"Hello World", ((Element.StringContent) ((DownloadResponse) object).element()).content());
}

@Test
Expand All @@ -130,7 +131,11 @@ void executeDownloadAsJsonContentAction() throws IOException {
assertInstanceOf(DownloadResponse.class, object);
DownloadResponse downloadResponse = (DownloadResponse) object;
assertNotNull(downloadResponse.element());
assertEquals("World", ((ObjectNode) downloadResponse.element()).get("Hello").asText());
assertEquals(
"World",
((JsonNode) ((Element.JsonContent) downloadResponse.element()).content())
.get("Hello")
.asText());
}

@Test
Expand All @@ -155,6 +160,7 @@ void executeDownloadAsBase64BytesContentAction() throws IOException {
DownloadResponse downloadResponse = (DownloadResponse) object;
assertNotNull(downloadResponse.element());
assertEquals(
Base64.getEncoder().encodeToString("Hello".getBytes()), downloadResponse.element());
Base64.getEncoder().encodeToString("Hello".getBytes()),
((Element.StringContent) downloadResponse.element()).content());
}
}

0 comments on commit 058a8c3

Please sign in to comment.