Skip to content

Commit 7cfbe26

Browse files
authored
Merge pull request #2160 from adobe/prepare-4-0-0
Prepare 4.0.0
2 parents ec52cbd + 698721b commit 7cfbe26

File tree

21 files changed

+163
-151
lines changed

21 files changed

+163
-151
lines changed

CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
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.0.0 - PLANNED](#400---planned)
14+
* [4.0.0](#400)
1515
* [DEPRECATED - 3.x](#deprecated---3x)
1616
* [3.12.0](#3120)
1717
* [3.11.0](#3110)
@@ -133,14 +133,21 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav
133133

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

136-
### 4.0.0 - PLANNED
136+
### 4.0.0
137137

138138
* Features and fixes
139+
* Allow overriding headers in head object
139140
* Implement If-(Un)modified-Since handling (fixes #829)
140141
* Refactorings
141-
* Use Tomcat instead of Jetty (fixes #2136)
142+
* Use Tomcat instead of Jetty as the application container (fixes #2136)
143+
* "FROM" in Dockerfile did not match "as"
142144
* Version updates (deliverable dependencies)
143145
* none
146+
* Version updates (build dependencies)
147+
* Bump github/codeql-action from 3.27.6 to 3.27.9
148+
* Bump com.puppycrawl.tools:checkstyle from 10.20.2 to 10.21.0
149+
* Jackson 2.18.2 to 2.17.2 (remove override, use Spring-Boot supplied version)
150+
144151

145152
# DEPRECATED - 3.x
146153
Version 3.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.

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>3.12.1-SNAPSHOT</version>
24+
<version>4.0.0-SNAPSHOT</version>
2525
</parent>
2626

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

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
FROM alpine:3.21.0@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45 as staging_area
17+
FROM alpine:3.21.0@sha256:21dc6063fd678b478f57c0e13f47560d0ea4eeba26dfc947b2a4f81f686b9f45 AS staging_area
1818

1919
RUN apk --no-cache add openjdk21-jdk openjdk21-jmods
2020

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>3.12.1-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>s3mock-docker</artifactId>

integration-tests/pom.xml

Lines changed: 4 additions & 4 deletions
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>3.12.1-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>s3mock-integration-tests</artifactId>
@@ -161,8 +161,8 @@
161161
<time>30000</time>
162162
</wait>
163163
<env>
164-
<validKmsKeys>arn:aws:kms:us-east-1:1234567890:key/valid-test-key-id</validKmsKeys>
165-
<initialBuckets>bucket-a, bucket-b</initialBuckets>
164+
<COM_ADOBE_TESTING_S3MOCK_DOMAIN_VALID_KMS_KEYS>arn:aws:kms:us-east-1:1234567890:key/valid-test-key-id</COM_ADOBE_TESTING_S3MOCK_DOMAIN_VALID_KMS_KEYS>
165+
<COM_ADOBE_TESTING_S3MOCK_DOMAIN_INITIAL_BUCKETS>bucket-a, bucket-b</COM_ADOBE_TESTING_S3MOCK_DOMAIN_INITIAL_BUCKETS>
166166
<COM_ADOBE_TESTING_S3MOCK_REGION>eu-west-1</COM_ADOBE_TESTING_S3MOCK_REGION>
167167
</env>
168168
<memory>192000000</memory>
@@ -243,7 +243,7 @@
243243
<it.s3mock.port_https>${it.s3mock.port_https}</it.s3mock.port_https>
244244
<it.s3mock.port_http>${it.s3mock.port_http}</it.s3mock.port_http>
245245
</systemPropertyVariables>
246-
<runOrder>alphabetical</runOrder>
246+
<runOrder>random</runOrder>
247247
</configuration>
248248
</execution>
249249
</executions>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import org.junit.jupiter.api.Test
3131
import org.junit.jupiter.api.TestInfo
3232
import java.io.File
3333
import java.io.FileInputStream
34-
import java.io.InputStream
3534
import java.util.UUID
3635

3736
/**
@@ -310,6 +309,7 @@ internal class CopyObjectV1IT : S3TestBase() {
310309
s3Client.getObject(destinationBucketName, destinationKey).use {
311310
val copiedDigest = DigestUtil.hexDigest(it.objectContent)
312311
assertThat(copiedDigest).isEqualTo(putObjectResult.eTag)
312+
assertThat(it.objectMetadata.contentLength).isEqualTo(uploadFile.length())
313313
}
314314
}
315315

@@ -328,8 +328,8 @@ internal class CopyObjectV1IT : S3TestBase() {
328328
val destinationKey = "copyOf/$sourceKey"
329329
val putObjectResult = s3Client.putObject(PutObjectRequest(bucketName, sourceKey, uploadFile))
330330
CopyObjectRequest(bucketName, sourceKey, destinationBucketName, destinationKey).also {
331-
s3Client.copyObject(it)
332-
}
331+
s3Client.copyObject(it)
332+
}
333333

334334
s3Client.getObject(destinationBucketName, destinationKey).use {
335335
val copiedDigest = DigestUtil.hexDigest(it.objectContent)

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,4 +388,42 @@ internal class CopyObjectV2IT : S3TestBase() {
388388
assertThat(it.response().contentDisposition()).isEqualTo("attachment")
389389
}
390390
}
391+
392+
@Test
393+
@S3VerifiedTodo
394+
fun testCopyObject_encrypted(testInfo: TestInfo) {
395+
val sourceKey = UPLOAD_FILE_NAME
396+
val uploadFile = File(UPLOAD_FILE_NAME)
397+
val bucketName = givenBucketV2(testInfo)
398+
399+
s3ClientV2.putObject(
400+
PutObjectRequest.builder()
401+
.bucket(bucketName)
402+
.key(sourceKey)
403+
.build(),
404+
RequestBody.fromFile(uploadFile)
405+
)
406+
407+
val destinationBucketName = givenRandomBucketV2()
408+
val destinationKey = "copyOf/$sourceKey"
409+
410+
s3ClientV2.copyObject(CopyObjectRequest
411+
.builder()
412+
.sourceBucket(bucketName)
413+
.sourceKey(sourceKey)
414+
.destinationBucket(destinationBucketName)
415+
.destinationKey(destinationKey)
416+
.sseCustomerKey(TEST_ENC_KEY_ID)
417+
.build()
418+
)
419+
420+
s3ClientV2.headObject(HeadObjectRequest
421+
.builder()
422+
.bucket(destinationBucketName)
423+
.key(destinationKey)
424+
.build()
425+
).also {
426+
assertThat(it.contentLength()).isEqualTo(uploadFile.length())
427+
}
428+
}
391429
}

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

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717
package com.adobe.testing.s3mock.its
1818

1919
import com.adobe.testing.s3mock.util.DigestUtil
20-
import org.apache.http.HttpHost
2120
import org.apache.http.HttpStatus
2221
import org.apache.http.client.methods.HttpOptions
2322
import org.apache.http.client.methods.HttpPut
2423
import org.apache.http.entity.ByteArrayEntity
2524
import org.apache.http.impl.client.CloseableHttpClient
26-
import org.apache.http.impl.client.HttpClientBuilder
27-
import org.apache.http.impl.client.HttpClients
2825
import org.apache.http.message.BasicHeader
2926
import org.assertj.core.api.Assertions.assertThat
3027
import org.junit.jupiter.api.Test
@@ -36,35 +33,28 @@ import java.util.UUID
3633
* Test the application using the AmazonS3 SDK V2.
3734
*/
3835
internal class CorsV2IT : S3TestBase() {
39-
private val httpClient: CloseableHttpClient = HttpClients.createDefault()
36+
private val httpClient: CloseableHttpClient = createHttpClient()
4037

4138
@Test
4239
@S3VerifiedFailure(year = 2024,
4340
reason = "No credentials sent in plain HTTP request")
4441
fun testPutObject_cors(testInfo: TestInfo) {
4542
val bucketName = givenBucketV2(testInfo)
46-
val httpclient = HttpClientBuilder.create().build()
47-
val optionsRequest = HttpOptions("/${bucketName}/testObjectName").apply {
43+
val optionsRequest = HttpOptions("$serviceEndpoint/${bucketName}/testObjectName").apply {
4844
this.addHeader("Origin", "http://localhost/")
4945
}
50-
httpclient.execute(HttpHost(
51-
host, httpPort
52-
), optionsRequest).also {
46+
httpClient.execute(optionsRequest).also {
5347
assertThat(it.getFirstHeader("Allow").value).contains("PUT")
5448
}
5549

5650
val byteArray = UUID.randomUUID().toString().toByteArray()
5751
val expectedEtag = "\"${DigestUtil.hexDigest(byteArray)}\""
58-
val putObject = HttpPut("/$bucketName/testObjectName").apply {
52+
val putObject = HttpPut("$serviceEndpoint/$bucketName/testObjectName").apply {
5953
this.entity = ByteArrayEntity(byteArray)
6054
this.addHeader("Origin", "http://localhost/")
6155
}
6256

63-
httpClient.execute(
64-
HttpHost(
65-
host, httpPort
66-
), putObject
67-
).use {
57+
httpClient.execute(putObject).use {
6858
assertThat(it.statusLine.statusCode).isEqualTo(HttpStatus.SC_OK)
6959
assertThat(it.getFirstHeader("ETag").value).isEqualTo(expectedEtag)
7060
assertThat(it.getFirstHeader("Access-Control-Allow-Origin").value).isEqualTo("*")
@@ -77,17 +67,13 @@ internal class CorsV2IT : S3TestBase() {
7767
reason = "No credentials sent in plain HTTP request")
7868
fun testGetBucket_cors(testInfo: TestInfo) {
7969
val targetBucket = givenBucketV2(testInfo)
80-
val httpOptions = HttpOptions("/$targetBucket").apply {
70+
val httpOptions = HttpOptions("$serviceEndpoint/$targetBucket").apply {
8171
this.addHeader(BasicHeader("Origin", "http://someurl.com"))
8272
this.addHeader(BasicHeader("Access-Control-Request-Method", "GET"))
8373
this.addHeader(BasicHeader("Access-Control-Request-Headers", "Content-Type, x-requested-with"))
8474
}
8575

86-
httpClient.execute(
87-
HttpHost(
88-
host, httpPort
89-
), httpOptions
90-
).use {
76+
httpClient.execute(httpOptions).use {
9177
assertThat(it.getFirstHeader("Access-Control-Allow-Origin").value).isEqualTo("http://someurl.com")
9278
assertThat(it.getFirstHeader("Access-Control-Allow-Methods").value).isEqualTo("GET")
9379
assertThat(it.getFirstHeader("Access-Control-Allow-Headers").value)

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ import com.amazonaws.services.s3.model.PutObjectRequest
3131
import com.amazonaws.services.s3.model.ResponseHeaderOverrides
3232
import com.amazonaws.services.s3.model.SSEAwsKeyManagementParams
3333
import com.amazonaws.services.s3.transfer.TransferManager
34-
import org.apache.http.HttpHost
3534
import org.apache.http.client.methods.HttpGet
36-
import org.apache.http.impl.client.HttpClients
35+
import org.apache.http.impl.client.CloseableHttpClient
3736
import org.assertj.core.api.Assertions.assertThat
3837
import org.assertj.core.api.Assertions.assertThatThrownBy
3938
import org.assertj.core.configuration.Configuration
@@ -47,14 +46,14 @@ import java.io.FileInputStream
4746
import java.io.InputStream
4847
import java.util.UUID
4948
import java.util.stream.Collectors
50-
import javax.net.ssl.HostnameVerifier
5149
import kotlin.math.min
5250

5351
/**
5452
* Test the application using the AmazonS3 SDK V1.
5553
*/
5654
internal class GetPutDeleteObjectV1IT : S3TestBase() {
5755

56+
private val httpClient: CloseableHttpClient = createHttpClient()
5857
private val s3Client: AmazonS3 = createS3ClientV1()
5958
private val transferManagerV1: TransferManager = createTransferManagerV1()
6059

@@ -82,6 +81,7 @@ internal class GetPutDeleteObjectV1IT : S3TestBase() {
8281
.build()
8382
uploadClient.putObject(PutObjectRequest(bucketName, uploadFile.name, uploadFile))
8483
s3Client.getObject(bucketName, uploadFile.name).also {
84+
assertThat(it.objectMetadata.contentLength).isEqualTo(uploadFile.length())
8585
verifyObjectContent(uploadFile, it)
8686
}
8787
}
@@ -459,12 +459,10 @@ internal class GetPutDeleteObjectV1IT : S3TestBase() {
459459
)
460460
this.method = HttpMethod.GET
461461
}
462-
val resourceUrl = createS3ClientV1(serviceEndpointHttp).generatePresignedUrl(presignedUrlRequest)
463-
HttpClients.createDefault().use {
462+
val resourceUrl = s3Client.generatePresignedUrl(presignedUrlRequest)
463+
httpClient.use {
464464
val getObject = HttpGet(resourceUrl.toString())
465-
it.execute(
466-
getObject
467-
).also { response ->
465+
it.execute(getObject).also { response ->
468466
assertThat(response.getFirstHeader(Headers.CACHE_CONTROL).value).isEqualTo("cacheControl")
469467
assertThat(response.getFirstHeader(Headers.CONTENT_DISPOSITION).value).isEqualTo("contentDisposition")
470468
assertThat(response.getFirstHeader(Headers.CONTENT_ENCODING).value).isEqualTo("contentEncoding")

0 commit comments

Comments
 (0)