Skip to content

feat: Add S3 hook support for upload, download, and list operations #745

Closed
therev2 wants to merge 2 commits intoauthorjapps:masterfrom
therev2:feature/s3-hook
Closed

feat: Add S3 hook support for upload, download, and list operations #745
therev2 wants to merge 2 commits intoauthorjapps:masterfrom
therev2:feature/s3-hook

Conversation

@therev2
Copy link

@therev2 therev2 commented Mar 17, 2026

Adds S3 support via the s3-bucket: prefix.

Supports S3.UPLOAD, S3.DOWNLOAD, S3.LIST operations.
Uses AWS_ACCESS_KEY_ID > s3.accessKey > AWS Default profile.
AWS SDK is to avoid bloat.
100% Mockito-backed tests added (Java 8 compatible).

Fixes #742

Copilot AI review requested due to automatic review settings March 17, 2026 09:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class S3 step-hook support to Zerocode scenarios by introducing an s3-bucket: URL prefix that routes steps to a new S3 client implementation backed by AWS SDK v2.

Changes:

  • Add AWS SDK v2 S3 dependency (managed in parent POM; optional in core).
  • Introduce S3 execution path end-to-end (API type detection → scenario runner routing → executor → S3 client → upload/download/list handlers).
  • Add Mockito-backed unit tests covering API type mapping, S3 client dispatching, and handler behavior.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pom.xml Adds AWS SDK version property and dependencyManagement entry for software.amazon.awssdk:s3.
core/pom.xml Adds optional AWS S3 SDK dependency to the core module.
core/src/main/java/org/jsmart/zerocode/core/constants/ZerocodeConstants.java Adds S3 and S3_BUCKET constants to support URL prefixing.
core/src/main/java/org/jsmart/zerocode/core/utils/ApiType.java Adds new S3_CALL enum value.
core/src/main/java/org/jsmart/zerocode/core/utils/ApiTypeUtils.java Detects s3-bucket: URLs and maps them to S3_CALL.
core/src/main/java/org/jsmart/zerocode/core/runner/ZeroCodeMultiStepsScenarioRunnerImpl.java Routes S3_CALL steps to the executor and extracts bucket name from s3-bucket: URL.
core/src/main/java/org/jsmart/zerocode/core/engine/executor/ApiServiceExecutor.java Adds executeS3Service(...) API.
core/src/main/java/org/jsmart/zerocode/core/engine/executor/ApiServiceExecutorImpl.java Wires S3 execution via injected BasicS3Client.
core/src/main/java/org/jsmart/zerocode/core/s3/client/BasicS3Client.java Implements S3 credential resolution + dispatch to upload/download/list handlers.
core/src/main/java/org/jsmart/zerocode/core/s3/upload/S3Uploader.java Upload handler using PutObject with file resolution.
core/src/main/java/org/jsmart/zerocode/core/s3/download/S3Downloader.java Download handler using GetObject to local path.
core/src/main/java/org/jsmart/zerocode/core/s3/list/S3Lister.java List handler with metadata mapping and manual/auto pagination behavior.
core/src/main/java/org/jsmart/zerocode/core/s3/domain/S3Request.java Defines S3 request payload fields (key/file/localPath/prefix/maxKeys/continuationToken).
core/src/main/java/org/jsmart/zerocode/core/s3/domain/S3Response.java Defines S3 response payload (status/s3Url/objects/truncated/nextContinuationToken).
core/src/main/java/org/jsmart/zerocode/core/s3/domain/ObjectInfo.java Defines list-object metadata model returned in responses.
core/src/test/java/org/jsmart/zerocode/core/utils/ApiTypeUtilsTest.java Adds tests for mapping s3-bucket: to S3_CALL.
core/src/test/java/org/jsmart/zerocode/core/s3/client/BasicS3ClientTest.java Adds dispatch tests for upload/download/list and unsupported operations.
core/src/test/java/org/jsmart/zerocode/core/s3/S3IntegrationTest.java Adds mocked AWS SDK tests validating handler requests/responses and pagination behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import java.io.File;
import java.io.FileWriter;
import java.lang.reflect.Field;
import java.nio.file.Files;
Comment on lines +503 to +508
String bucketName = url.substring(S3_BUCKET.length());
String s3Operation = operationName;
if (s3Operation.toUpperCase().startsWith("S3.")) {
s3Operation = s3Operation.substring(3);
}
executionResult = apiExecutor.executeS3Service(bucketName, s3Operation, resolvedRequestJsonMaskRemoved);
Comment on lines 37 to +41
} else if (serviceName.contains("://") && !serviceName.startsWith("http")) {
apiType = ApiType.JAVA_CALL;

} else if (serviceName != null && serviceName.startsWith(S3_BUCKET)) {
apiType = ApiType.S3_CALL;
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<optional>true</optional>
Comment on lines +25 to +27
@Inject(optional = true)
private BasicS3Client s3Client;

Comment on lines +80 to +85
try {
return Paths.get(resource.toURI()).toString();
} catch (java.net.URISyntaxException e) {
LOGGER.warn("Could not convert resource URL to URI: {}", resource, e);
}
}
@therev2 therev2 closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add S3 Hook to Enable Zerocode-TDD Steps for Upload, List, and Download Scenarios

2 participants