Skip to content

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

Open
therev2 wants to merge 4 commits intoauthorjapps:masterfrom
therev2:feature/s3-hook
Open

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

Conversation

@therev2
Copy link

@therev2 therev2 commented Mar 19, 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

Fixes #742

Copilot AI review requested due to automatic review settings March 19, 2026 18:32
@therev2
Copy link
Author

therev2 commented Mar 19, 2026

@authorjapps i added the tests and they are present in the file S3integrationtest.java file where the tests are Mockito based which get mapped to .json format
I saw the CI fails and corrected my code (There were a lot of unstaged changes in my code which did not get commit in the old PR)
Also, I ran the S3 tests locally and they were running fine.
I am really sorry for the delay.

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 support to Zerocode’s multi-step runner via the s3-bucket: URL prefix, enabling scenario steps to UPLOAD, DOWNLOAD, and LIST S3 objects using AWS SDK v2.

Changes:

  • Introduces S3_CALL API type detection and routes S3 steps through the scenario runner + service executor.
  • Implements S3 client dispatcher (BasicS3Client) and operation handlers (S3Uploader, S3Downloader, S3Lister) with request/response domain models.
  • Adds AWS SDK S3 dependency management and new unit tests for the S3 flow.

Reviewed changes

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

Show a summary per file
File Description
pom.xml Adds AWS SDK version property and manages software.amazon.awssdk:s3 version.
core/pom.xml Adds optional software.amazon.awssdk:s3 dependency to the core module.
core/src/main/java/org/jsmart/zerocode/core/constants/ZerocodeConstants.java Adds S3_BUCKET prefix constant used for routing.
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 as S3_CALL.
core/src/main/java/org/jsmart/zerocode/core/runner/ZeroCodeMultiStepsScenarioRunnerImpl.java Routes S3 steps to the executor and normalizes S3.* operations.
core/src/main/java/org/jsmart/zerocode/core/engine/executor/ApiServiceExecutor.java Adds the executeS3Service API.
core/src/main/java/org/jsmart/zerocode/core/engine/executor/ApiServiceExecutorImpl.java Wires S3 execution via an injected BasicS3Client.
core/src/main/java/org/jsmart/zerocode/core/s3/client/BasicS3Client.java Implements S3 client creation, credential resolution, and operation dispatch.
core/src/main/java/org/jsmart/zerocode/core/s3/upload/S3Uploader.java Implements file upload to S3 using request JSON.
core/src/main/java/org/jsmart/zerocode/core/s3/download/S3Downloader.java Implements object download to a local path using request JSON.
core/src/main/java/org/jsmart/zerocode/core/s3/list/S3Lister.java Implements list operation with optional pagination behavior and metadata mapping.
core/src/main/java/org/jsmart/zerocode/core/s3/domain/S3Request.java Adds request model with aliases (filePath, saveAs, folder) and pagination fields.
core/src/main/java/org/jsmart/zerocode/core/s3/domain/S3Response.java Adds response model for upload/list/download outputs.
core/src/main/java/org/jsmart/zerocode/core/s3/domain/ObjectInfo.java Adds list-item metadata model for S3 objects.
core/src/test/java/org/jsmart/zerocode/core/utils/ApiTypeUtilsTest.java Adds unit tests for S3 URL detection and non-S3 regressions.
core/src/test/java/org/jsmart/zerocode/core/s3/client/BasicS3ClientTest.java Adds unit tests verifying operation dispatch behavior.
core/src/test/java/org/jsmart/zerocode/core/s3/S3IntegrationTest.java Adds mocked-S3Client tests for upload/download/list handlers.

💡 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 +144 to +147
GetObjectResponse getObjectResponse = GetObjectResponse.builder().build();
ResponseInputStream<GetObjectResponse> responseStream =
new ResponseInputStream<>(getObjectResponse, new ByteArrayInputStream("content".getBytes()));

@Inject
private BasicKafkaClient kafkaClient;

@Inject(optional = true)
Comment on lines +52 to +62
String localFilePath = resolveFilePath(request.getFile());

LOGGER.debug("Uploading file '{}' to s3://{}/{}", localFilePath, bucketName, request.getKey());

PutObjectRequest putRequest = PutObjectRequest.builder()
.bucket(bucketName)
.key(request.getKey())
.build();

s3Client.putObject(putRequest, RequestBody.fromFile(Paths.get(localFilePath)));

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