feat: implement File API capabilities matching Python SDK - #1
Merged
Conversation
- Introduce `FileUpload` utility to encapsulate multipart form logic and base64 handling - Update `TestClient` to allow implicit file uploads during `Test` creation - Add method overloading on `TestClient` (`addFile` and `addFileFromBase64`) for idiomatic single-file uploads matching Python's duck-typed API - Fix `TestType` Jackson deserialization to handle various nested/string formats returned by the API - Add `TestSetClient.getTests()` to retrieve platform-generated nested tests - Introduce `FileSupportExample` and `GenerateTestSetWithFilesExample` to demonstrate usage - Expand unit and integration tests to cover file lifecycles and base64 uploads
- Add Lombok dependency to pom.xml - Apply @builder annotation to all SDK entities - Remove boilerplate Builder implementations - Update unit and integration tests to use Lombok builders
- Bump version in pom.xml to 0.1.1 for patch release - Create CHANGELOG.md documenting changes (file API capabilities, Lombok builders)
- Document initial release features (core entities, API clients) - Document testing setup (unit, integration, WireMock, AssertJ) - Document CI/CD and tooling setup (Makefile, Github Packages, linters)
- Remove fully qualified `java.nio.file.Path` since `Path` is already imported - Use `FileUpload.fromFile()` explicitly for `java.io.File` so we can drop the fully qualified `java.io.File file` declaration safely - Update `Makefile` test rules to skip PMD, ensuring `make test` focuses only on testing and leaves static analysis to `make lint`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces the File API capabilities to the Java SDK, aligning its functionality with the existing Python SDK implementation. It includes utilities for managing multi-part file uploads, allows for the attachment of files to
Testentities, and significantly reduces boilerplate code using Lombok builders.Key Changes
FileUploadto handle multipart form data correctly, including native path handling and Base64 string uploads.TestClientto allow files to be passed when creating aTest, mirroring the Python SDK. AddedTestSetClient.getTests()to fetch automatically generated tests from the backend to allow file attachments.addFile(Path),addFile(File), andaddFileFromBase64(...)methods directly on theTestClientto handle single files dynamically.Lombokdependency and applied@Builderto allai.rhesis.sdk.entitiesobjects. This eliminated verbose constructors, making example and test code much cleaner.NameStringDeserializerand@JsonCreatorannotations to correctly deserialize enums and API values that return as both strings and nested JSON objects depending on the endpoint.CHANGELOG.mdand prepared version0.1.1for release.Test plan
mvn clean test) to verify WireMock endpoints parsing multiform-data requests.mvn failsafe:integration-test) to ensure files are successfully uploaded and attached to the Rhesis backend platform.FileSupportExampleandGenerateTestSetWithFilesExampleto verify user workflows are functioning correctly.