Skip to content

Commit e4ecc80

Browse files
authored
Merge pull request #2382 from adobe/2371-conditional-writes-putobject-wildcards
Let S3Mock accept * and "*" for conditional requests
2 parents f6de54c + 5b39ace commit e4ecc80

File tree

27 files changed

+883
-516
lines changed

27 files changed

+883
-516
lines changed

CHANGELOG.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
* [PLANNED - 5.x - RELEASE TBD](#planned---5x---release-tbd)
1212
* [Planned changes](#planned-changes)
1313
* [CURRENT - 4.x - THIS VERSION IS UNDER ACTIVE DEVELOPMENT](#current---4x---this-version-is-under-active-development)
14-
* [4.3.0 - PLANNED](#430---planned)
14+
* [4.4.0 - PLANNED](#440---planned)
15+
* [4.3.0](#430)
1516
* [4.2.0](#420)
1617
* [4.1.1](#411)
1718
* [4.1.0](#410)
@@ -141,7 +142,7 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav
141142

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

144-
## 4.3.0 - PLANNED
145+
## 4.4.0 - PLANNED
145146
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
146147

147148
* Features and fixes
@@ -153,6 +154,22 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav
153154
* Version updates (build dependencies)
154155
* none
155156

157+
## 4.3.0
158+
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
159+
160+
* Features and fixes
161+
* S3Mock accepts * for conditional requests on all APIs. (fixes #2371)
162+
* Clarifications for S3Mock with custom SSL certificate usage in README.md
163+
* Clarifications for S3Mock with provided SSL certificate usage in README.md
164+
* Refactorings
165+
* none
166+
* Version updates (deliverable dependencies)
167+
* Bump aws-v2.version from 2.31.38 to 2.31.42
168+
* Version updates (build dependencies)
169+
* Bump aws.sdk.kotlin:s3-jvm from 1.4.80 to 1.4.83
170+
* Bump kotlin.version from 2.1.20 to 2.1.21
171+
* Bump actions/dependency-review-action from 4.7.0 to 4.7.1
172+
156173
## 4.2.0
157174
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
158175

@@ -179,11 +196,11 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav
179196
* PutObject now supports conditional requests
180197
* Version updates (deliverable dependencies)
181198
* Bump aws-v2.version from 2.31.25 to 2.31.38
182-
* Bump aws.sdk.kotlin:s3-jvm from 1.4.67 to 1.4.80
183199
* Bump aws.version from 1.12.782 to 1.12.783
184200
* Bump spring-boot.version from 3.4.4 to 3.4.5
185201
* Bump testcontainers.version from 1.20.6 to 1.21.0
186202
* Version updates (build dependencies)
203+
* Bump aws.sdk.kotlin:s3-jvm from 1.4.67 to 1.4.80
187204
* Bump actions/dependency-review-action from 4.6.0 to 4.7.0
188205
* Bump github/codeql-action from 3.28.15 to 3.28.17
189206
* Bump com.puppycrawl.tools:checkstyle from 10.23.0 to 10.23.1
@@ -212,9 +229,9 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav
212229
* Migrate all integration tests to AWS SDK v2, remove AWS SDK v1 tests from the integration-tests module
213230
* Version updates (deliverable dependencies)
214231
* Bump aws-v2.version from 2.31.17 to 2.31.25
215-
* Bump aws.sdk.kotlin:s3-jvm from 1.4.59 to 1.4.67
216232
* Bump commons-io:commons-io from 2.18.0 to 2.19.0
217233
* Version updates (build dependencies)
234+
* Bump aws.sdk.kotlin:s3-jvm from 1.4.59 to 1.4.67
218235
* Bump step-security/harden-runner from 2.11.1 to 2.12.0
219236
* Bump actions/setup-java from 4.7.0 to 4.7.1
220237

@@ -239,13 +256,13 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav
239256
* Jackson 2.18.2 to 2.17.2 (remove override, use Spring-Boot supplied version)
240257
* Bump aws-v2.version from 2.29.29 to 2.31.17
241258
* Bump aws.version from 1.12.779 to 1.12.780
242-
* Bump aws.sdk.kotlin:s3-jvm from 1.4.41 to 1.4.59
243259
* Bump kotlin.version from 2.1.0 to 2.1.20
244260
* Bump testcontainers.version from 1.20.4 to 1.20.6
245261
* Bump org.testng:testng from 7.10.2 to 7.11.0
246262
* Bump aws.version from 1.12.780 to 1.12.782
247263
* Bump alpine from 3.21.0 to 3.21.3 in /docker
248264
* Version updates (build dependencies)
265+
* Bump aws.sdk.kotlin:s3-jvm from 1.4.41 to 1.4.59
249266
* Bump org.apache.maven.plugins:maven-compiler-plugin from 3.13.0 to 3.14.0
250267
* Bump org.apache.maven.plugins:maven-clean-plugin from 3.4.0 to 3.4.1
251268
* Bump org.apache.maven.plugins:maven-install-plugin from 3.1.3 to 3.1.4

build-config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>com.adobe.testing</groupId>
2323
<artifactId>s3mock-parent</artifactId>
24-
<version>4.2.1-SNAPSHOT</version>
24+
<version>4.3.0-SNAPSHOT</version>
2525
</parent>
2626

2727
<artifactId>s3mock-build-config</artifactId>

docker/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>com.adobe.testing</groupId>
2424
<artifactId>s3mock-parent</artifactId>
25-
<version>4.2.1-SNAPSHOT</version>
25+
<version>4.3.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>s3mock-docker</artifactId>

integration-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>com.adobe.testing</groupId>
2424
<artifactId>s3mock-parent</artifactId>
25-
<version>4.2.1-SNAPSHOT</version>
25+
<version>4.3.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>s3mock-integration-tests</artifactId>

integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/AwsChunkedEncodingIT.kt

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ import software.amazon.awssdk.checksums.DefaultChecksumAlgorithm
2424
import software.amazon.awssdk.core.sync.RequestBody
2525
import software.amazon.awssdk.services.s3.model.ChecksumAlgorithm
2626
import software.amazon.awssdk.services.s3.model.ChecksumMode
27-
import java.io.File
28-
import java.io.FileInputStream
29-
import java.io.InputStream
3027

3128
/**
3229
* Chunked encoding with signing is only active in AWS SDK v2 when endpoint is http
@@ -47,18 +44,18 @@ internal class AwsChunkedEncodingIT : S3TestBase() {
4744
)
4845
fun `put object with checksum returns correct checksum, get object returns checksum`(testInfo: TestInfo) {
4946
val bucket = givenBucket(testInfo)
50-
val uploadFile = File(UPLOAD_FILE_NAME)
51-
val uploadFileIs: InputStream = FileInputStream(uploadFile)
52-
val expectedEtag = "\"${DigestUtil.hexDigest(uploadFileIs)}\""
53-
val expectedChecksum = DigestUtil.checksumFor(uploadFile.toPath(), DefaultChecksumAlgorithm.SHA256)
47+
val expectedEtag = UPLOAD_FILE.inputStream().use {
48+
"\"${DigestUtil.hexDigest(it)}\""
49+
}
50+
val expectedChecksum = DigestUtil.checksumFor(UPLOAD_FILE_PATH, DefaultChecksumAlgorithm.SHA256)
5451

5552
val putObjectResponse = s3Client.putObject(
5653
{
5754
it.bucket(bucket)
5855
it.key(UPLOAD_FILE_NAME)
5956
it.checksumAlgorithm(ChecksumAlgorithm.SHA256)
6057
},
61-
RequestBody.fromFile(uploadFile)
58+
RequestBody.fromFile(UPLOAD_FILE)
6259
)
6360

6461
putObjectResponse.checksumSHA256().also {
@@ -70,9 +67,9 @@ internal class AwsChunkedEncodingIT : S3TestBase() {
7067
it.bucket(bucket)
7168
it.checksumMode(ChecksumMode.ENABLED)
7269
it.key(UPLOAD_FILE_NAME)
73-
}.also {
70+
}.use {
7471
assertThat(it.response().eTag()).isEqualTo(expectedEtag)
75-
assertThat(it.response().contentLength()).isEqualTo(uploadFile.length())
72+
assertThat(it.response().contentLength()).isEqualTo(UPLOAD_FILE_LENGTH)
7673
assertThat(it.response().contentEncoding()).isNotEqualTo("aws-chunked")
7774
it.response().checksumSHA256().also {
7875
assertThat(it).isNotBlank
@@ -93,24 +90,24 @@ internal class AwsChunkedEncodingIT : S3TestBase() {
9390
)
9491
fun `put object creates correct etag, get object returns etag`(testInfo: TestInfo) {
9592
val bucket = givenBucket(testInfo)
96-
val uploadFile = File(UPLOAD_FILE_NAME)
97-
val uploadFileIs: InputStream = FileInputStream(uploadFile)
98-
val expectedEtag = "\"${DigestUtil.hexDigest(uploadFileIs)}\""
93+
val expectedEtag = UPLOAD_FILE.inputStream().use {
94+
"\"${DigestUtil.hexDigest(it)}\""
95+
}
9996

10097
s3Client.putObject(
10198
{
10299
it.bucket(bucket)
103100
it.key(UPLOAD_FILE_NAME)
104101
},
105-
RequestBody.fromFile(uploadFile)
102+
RequestBody.fromFile(UPLOAD_FILE)
106103
)
107104

108105
s3Client.getObject {
109106
it.bucket(bucket)
110107
it.key(UPLOAD_FILE_NAME)
111-
}.also {
108+
}.use {
112109
assertThat(it.response().eTag()).isEqualTo(expectedEtag)
113-
assertThat(it.response().contentLength()).isEqualTo(uploadFile.length())
110+
assertThat(it.response().contentLength()).isEqualTo(UPLOAD_FILE_LENGTH)
114111
assertThat(it.response().contentEncoding()).isNotEqualTo("aws-chunked")
115112
}
116113
}
@@ -122,8 +119,6 @@ internal class AwsChunkedEncodingIT : S3TestBase() {
122119
)
123120
fun `put object creates correct content-encoding, get object returns content-encoding`(testInfo: TestInfo) {
124121
val bucket = givenBucket(testInfo)
125-
val uploadFile = File(UPLOAD_FILE_NAME)
126-
127122
val customEncoding = "my-custom-encoding"
128123

129124
s3Client.putObject(
@@ -132,13 +127,13 @@ internal class AwsChunkedEncodingIT : S3TestBase() {
132127
it.key(UPLOAD_FILE_NAME)
133128
it.contentEncoding(customEncoding)
134129
},
135-
RequestBody.fromFile(uploadFile)
130+
RequestBody.fromFile(UPLOAD_FILE)
136131
)
137132

138133
s3Client.getObject {
139134
it.bucket(bucket)
140135
it.key(UPLOAD_FILE_NAME)
141-
}.also {
136+
}.use {
142137
assertThat(it.response().contentEncoding()).isEqualTo(customEncoding)
143138
}
144139
}

integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ConcurrencyIT.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ internal class ConcurrencyIT : S3TestBase() {
7272
s3Client.getObject {
7373
it.bucket(bucketName)
7474
it.key(key)
75-
}.also {
75+
}.use {
7676
assertThat(it.response().eTag()).isNotBlank
7777
}
7878

0 commit comments

Comments
 (0)