Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support versioning #1895

Merged
merged 14 commits into from
Apr 8, 2025
76 changes: 66 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
<!-- TOC -->
* [Changelog](#changelog)
* [PLANNED - 5.x - RELEASE TBD](#planned---5x---release-tbd)
* [Planned changes](#planned-changes)
* [Planned changes](#planned-changes)
* [CURRENT - 4.x - THIS VERSION IS UNDER ACTIVE DEVELOPMENT](#current---4x---this-version-is-under-active-development)
* [4.0.0](#400)
* [4.1.1 - PLANNED](#411---planned)
* [4.1.0 - PLANNED](#410---planned)
* [4.0.0](#400)
* [DEPRECATED - 3.x](#deprecated---3x)
* [3.12.0](#3120)
* [3.11.0](#3110)
Expand Down Expand Up @@ -113,11 +115,13 @@ Running S3Mock in unit tests is still supported by using [TestContainers](https:

**Once 5.x is released, 4.x may receive bug fixes and features, this will be best-effort only.**

### Planned changes
## Planned changes

* Features and fixes
* TBD
* Refactorings
* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.
* S3Mock will remove usage of Java v1 early 2026.
* Looking to Remove unit test modules. This enables
* Refactoring S3Mock to a "standard" Spring Boot application.
* Removal of workarounds to use `S3MockApplication#start` from a static context
Expand All @@ -133,24 +137,76 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav

**The current major version 4 will receive new features, dependency updates and bug fixes on a continuous basis.**

### 4.0.0
## 4.1.1 - PLANNED
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.

* Features and fixes
* Content-Encoding: aws-chunked should not be stored (fixes #2218)
* Refactorings
* TBD
* Version updates (deliverable dependencies)
* TBD
* Version updates (build dependencies)
* TBD

## 4.1.0 - PLANNED
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.

* Features and fixes
* Support Browser-Based Uploads Using POST (fixes #2200)
* https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html
* Refactorings
* TBD
* Version updates (deliverable dependencies)
* TBD
* Version updates (build dependencies)
* TBD

## 4.0.0
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.

* Features and fixes
* Basic support for versions in API (fixes #64)
* Allow overriding headers in head object
* Implement If-(Un)modified-Since handling (fixes #829)
* Close all InputStreams and OutputStreams
* Add AWS SDK V1 deprecation notice
* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.
* S3Mock will remove usage of Java v1 early 2026.
* Refactorings
* Use Tomcat instead of Jetty as the application container (fixes #2136)
* "FROM" in Dockerfile did not match "as"
* Delete files on shutdown using a `DisposableBean` instead of `File#deleteOnExit()`
* Version updates (deliverable dependencies)
* Bump spring-boot.version from 3.3.5 to 3.4.1
* Version updates (build dependencies)
* Bump github/codeql-action from 3.27.6 to 3.27.9
* Bump actions/upload-artifact from 4.4.3 to 4.5.0
* Bump actions/setup-java from 4.5.0 to 4.6.0
* Bump com.puppycrawl.tools:checkstyle from 10.20.2 to 10.21.0
* Bump spring-boot.version from 3.3.5 to 3.4.4
* Jackson 2.18.2 to 2.17.2 (remove override, use Spring-Boot supplied version)
* Bump aws-v2.version from 2.29.29 to 2.31.17
* Bump aws.version from 1.12.779 to 1.12.780
* Bump aws.sdk.kotlin:s3-jvm from 1.4.41 to 1.4.59
* Bump kotlin.version from 2.1.0 to 2.1.20
* Bump testcontainers.version from 1.20.4 to 1.20.6
* Bump org.testng:testng from 7.10.2 to 7.11.0
* Bump aws.version from 1.12.780 to 1.12.782
* Bump alpine from 3.21.0 to 3.21.3 in /docker
* Version updates (build dependencies)
* Bump org.apache.maven.plugins:maven-compiler-plugin from 3.13.0 to 3.14.0
* Bump org.apache.maven.plugins:maven-clean-plugin from 3.4.0 to 3.4.1
* Bump org.apache.maven.plugins:maven-install-plugin from 3.1.3 to 3.1.4
* Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.3 to 3.1.4
* Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.5.2 to 3.5.3
* Bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.2 to 3.5.3
* Bump io.fabric8:docker-maven-plugin from 0.45.1 to 0.46.0
* Bump org.jacoco:jacoco-maven-plugin from 0.8.12 to 0.8.13
* Bump license-maven-plugin-git.version from 4.6 to 5.0.0
* Bump github/codeql-action from 3.27.6 to 3.28.15
* Bump docker/setup-qemu-action from 3.2.0 to 3.6.0
* Bump actions/upload-artifact from 4.4.3 to 4.6.2
* Bump actions/setup-java from 4.5.0 to 4.7.0
* Bump actions/dependency-review-action from 4.5.0 to 4.6.0
* Bump step-security/harden-runner from 2.10.2 to 2.11.1
* Bump ossf/scorecard-action from 2.4.0 to 2.4.1
* Bump com.puppycrawl.tools:checkstyle from 10.20.2 to 10.23.0
* Bump advanced-security/sbom-generator-action from 0.0.1 to 0.0.2


# DEPRECATED - 3.x
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Of these [operations of the Amazon S3 API](https://docs.aws.amazon.com/AmazonS3/
| [GetBucketReplication](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketReplication.html) | :x: | |
| [GetBucketRequestPayment](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketRequestPayment.html) | :x: | |
| [GetBucketTagging](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html) | :x: | |
| [GetBucketVersioning](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html) | :x: | |
| [GetBucketVersioning](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html) | :white_check_mark: | |
| [GetBucketWebsite](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketWebsite.html) | :x: | |
| [GetObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) | :white_check_mark: | |
| [GetObjectAcl](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAcl.html) | :white_check_mark: | |
Expand Down Expand Up @@ -143,7 +143,7 @@ Of these [operations of the Amazon S3 API](https://docs.aws.amazon.com/AmazonS3/
| [PutBucketReplication](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketReplication.html) | :x: | |
| [PutBucketRequestPayment](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketRequestPayment.html) | :x: | |
| [PutBucketTagging](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketTagging.html) | :x: | |
| [PutBucketVersioning](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketVersioning.html) | :x: | |
| [PutBucketVersioning](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketVersioning.html) | :white_check_mark: | |
| [PutBucketWebsite](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketWebsite.html) | :x: | |
| [PutObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) | :white_check_mark: | |
| [PutObjectAcl](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectAcl.html) | :white_check_mark: | |
Expand Down
6 changes: 4 additions & 2 deletions build-config/src/main/resources/build-config/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--

Copyright 2017-2021 Adobe.
Copyright 2017-2025 Adobe.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -201,7 +201,9 @@
<property name="allowedAbbreviationLength" value="4"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="VariableDeclarationUsageDistance">
<property name="allowedDistance" value="4"/>
</module>
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
Expand Down
4 changes: 3 additions & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-docker</artifactId>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
Expand Down Expand Up @@ -70,6 +71,7 @@
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
Expand Down Expand Up @@ -170,7 +172,7 @@
<COM_ADOBE_TESTING_S3MOCK_DOMAIN_INITIAL_BUCKETS>bucket-a, bucket-b</COM_ADOBE_TESTING_S3MOCK_DOMAIN_INITIAL_BUCKETS>
<COM_ADOBE_TESTING_S3MOCK_REGION>eu-west-1</COM_ADOBE_TESTING_S3MOCK_REGION>
</env>
<memory>192000000</memory>
<memory>256000000</memory>
</run>
</image>
</images>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Adobe.
* Copyright 2017-2025 Adobe.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,8 @@ import java.util.stream.Collectors
/**
* Test the application using the AmazonS3 SDK V1.
*/
@Deprecated("* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.\n" +
" * S3Mock will remove usage of Java v1 early 2026.")
internal class BucketV1IT : S3TestBase() {

private val s3Client: AmazonS3 = createS3ClientV1()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Adobe.
* Copyright 2017-2025 Adobe.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,7 @@ import software.amazon.awssdk.awscore.exception.AwsServiceException
import software.amazon.awssdk.services.s3.S3Client
import software.amazon.awssdk.services.s3.model.AbortIncompleteMultipartUpload
import software.amazon.awssdk.services.s3.model.BucketLifecycleConfiguration
import software.amazon.awssdk.services.s3.model.BucketVersioningStatus
import software.amazon.awssdk.services.s3.model.CreateBucketRequest
import software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleRequest
import software.amazon.awssdk.services.s3.model.DeleteBucketRequest
Expand All @@ -36,6 +37,8 @@ import software.amazon.awssdk.services.s3.model.HeadBucketRequest
import software.amazon.awssdk.services.s3.model.LifecycleExpiration
import software.amazon.awssdk.services.s3.model.LifecycleRule
import software.amazon.awssdk.services.s3.model.LifecycleRuleFilter
import software.amazon.awssdk.services.s3.model.MFADelete
import software.amazon.awssdk.services.s3.model.MFADeleteStatus
import software.amazon.awssdk.services.s3.model.NoSuchBucketException
import software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationRequest
import java.util.concurrent.TimeUnit
Expand Down Expand Up @@ -79,6 +82,89 @@ internal class BucketV2IT : S3TestBase() {
assertThat(bucketLocation.locationConstraint().toString()).isEqualTo("eu-west-1")
}

@Test
@S3VerifiedSuccess(year = 2024)
fun getDefaultBucketVersioning(testInfo: TestInfo) {
val bucketName = givenBucketV2(testInfo)

s3ClientV2.getBucketVersioning {
it.bucket(bucketName)
}.also {
assertThat(it.status()).isNull()
assertThat(it.mfaDelete()).isNull()
}
}

@Test
@S3VerifiedTodo
fun putAndGetBucketVersioning(testInfo: TestInfo) {
val bucketName = givenBucketV2(testInfo)
s3ClientV2.putBucketVersioning {
it.bucket(bucketName)
it.versioningConfiguration {
it.status(BucketVersioningStatus.ENABLED)
}
}

s3ClientV2.getBucketVersioning {
it.bucket(bucketName)
}.also {
assertThat(it.status()).isEqualTo(BucketVersioningStatus.ENABLED)
}
}

@Test
@S3VerifiedTodo
fun putAndGetBucketVersioning_suspended(testInfo: TestInfo) {
val bucketName = givenBucketV2(testInfo)
s3ClientV2.putBucketVersioning {
it.bucket(bucketName)
it.versioningConfiguration {
it.status(BucketVersioningStatus.ENABLED)
}
}

s3ClientV2.getBucketVersioning {
it.bucket(bucketName)
}.also {
assertThat(it.status()).isEqualTo(BucketVersioningStatus.ENABLED)
}

s3ClientV2.putBucketVersioning {
it.bucket(bucketName)
it.versioningConfiguration {
it.status(BucketVersioningStatus.SUSPENDED)
}
}

s3ClientV2.getBucketVersioning {
it.bucket(bucketName)
}.also {
assertThat(it.status()).isEqualTo(BucketVersioningStatus.SUSPENDED)
}
}

@Test
@S3VerifiedFailure(year = 2024, reason = "No real Mfa value")
fun putAndGetBucketVersioning_mfa(testInfo: TestInfo) {
val bucketName = givenBucketV2(testInfo)
s3ClientV2.putBucketVersioning {
it.bucket(bucketName)
it.mfa("fakeMfaValue")
it.versioningConfiguration {
it.status(BucketVersioningStatus.ENABLED)
it.mfaDelete(MFADelete.ENABLED)
}
}

s3ClientV2.getBucketVersioning {
it.bucket(bucketName)
}.also {
assertThat(it.status()).isEqualTo(BucketVersioningStatus.ENABLED)
assertThat(it.mfaDelete()).isEqualTo(MFADeleteStatus.ENABLED)
}
}

@Test
@S3VerifiedSuccess(year = 2024)
fun duplicateBucketCreation(testInfo: TestInfo) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Adobe.
* Copyright 2017-2025 Adobe.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,6 +36,8 @@ import java.util.UUID
/**
* Test the application using the AmazonS3 SDK V1.
*/
@Deprecated("* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.\n" +
" * S3Mock will remove usage of Java v1 early 2026.")
internal class CopyObjectV1IT : S3TestBase() {

private val s3Client: AmazonS3 = createS3ClientV1()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Adobe.
* Copyright 2017-2025 Adobe.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,6 +41,8 @@ import java.util.UUID
* Test the application using the AmazonS3 SDK V1.
* Verifies S3 Mocks Error Responses.
*/
@Deprecated("* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.\n" +
" * S3Mock will remove usage of Java v1 early 2026.")
internal class ErrorResponsesV1IT : S3TestBase() {

private val s3Client: AmazonS3 = createS3ClientV1()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Adobe.
* Copyright 2017-2025 Adobe.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,6 +51,8 @@ import kotlin.math.min
/**
* Test the application using the AmazonS3 SDK V1.
*/
@Deprecated("* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.\n" +
" * S3Mock will remove usage of Java v1 early 2026.")
internal class GetPutDeleteObjectV1IT : S3TestBase() {

private val httpClient: CloseableHttpClient = createHttpClient()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Adobe.
* Copyright 2017-2025 Adobe.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,6 +33,8 @@ import java.util.stream.Collectors
/**
* Test the application using the AmazonS3 SDK V1.
*/
@Deprecated("* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.\n" +
" * S3Mock will remove usage of Java v1 early 2026.")
internal class ListObjectV1IT : S3TestBase() {

val s3Client: AmazonS3 = createS3ClientV1()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2024 Adobe.
* Copyright 2017-2025 Adobe.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,8 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInfo

@Deprecated("* AWS has deprecated SDK for Java v1, and will remove support EOY 2025.\n" +
" * S3Mock will remove usage of Java v1 early 2026.")
internal class ListObjectV1MaxKeysIT : S3TestBase() {
val s3Client: AmazonS3 = createS3ClientV1()

Expand Down
Loading
Loading