Skip to content

Commit 9b6443a

Browse files
authored
Merge pull request #2413 from adobe/2412-correct-order-for-listversions
2412 correct order for listversions
2 parents ad57ef2 + ec42f42 commit 9b6443a

File tree

15 files changed

+83
-31
lines changed

15 files changed

+83
-31
lines changed

CHANGELOG.md

Lines changed: 20 additions & 2 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.4.0 - PLANNED](#440---planned)
14+
* [4.5.0 - PLANNED](#450---planned)
15+
* [4.4.0](#440)
1516
* [4.3.0](#430)
1617
* [4.2.0](#420)
1718
* [4.1.1](#411)
@@ -142,7 +143,7 @@ Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Jav
142143

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

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

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

158+
## 4.4.0
159+
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
160+
161+
* Features and fixes
162+
* Fix order of ListObjectVersions (fixes #2412)
163+
* Refactorings
164+
* Remove configuration exclusions for Spring Security classes
165+
* We don't include Spring Security dependencies anymore.
166+
* Version updates (deliverable dependencies)
167+
* Bump spring-boot.version from 3.4.5 to 3.5.0
168+
* Bump aws-v2.version from 2.31.42 to 2.31.50
169+
* Version updates (build dependencies)
170+
* Bump aws.sdk.kotlin:s3-jvm from 1.4.83 to 1.4.91
171+
* Bump org.xmlunit:xmlunit-assertj3 from 2.10.0 to 2.10.2
172+
* Bump com.puppycrawl.tools:checkstyle from 10.23.1 to 10.24.0
173+
* Bump github/codeql-action from 3.28.17 to 3.28.18
174+
157175
## 4.3.0
158176
Version 4.x is JDK17 LTS bytecode compatible, with Docker and JUnit / direct Java integration.
159177

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.3.1-SNAPSHOT</version>
24+
<version>4.4.0-SNAPSHOT</version>
2525
</parent>
2626

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

docker/pom.xml

Lines changed: 1 addition & 2 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>4.3.1-SNAPSHOT</version>
25+
<version>4.4.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>s3mock-docker</artifactId>
@@ -70,7 +70,6 @@
7070
<plugin>
7171
<groupId>org.apache.maven.plugins</groupId>
7272
<artifactId>maven-dependency-plugin</artifactId>
73-
<version>3.8.1</version>
7473
<configuration>
7574
<artifactItems>
7675
<artifactItem>

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.3.1-SNAPSHOT</version>
25+
<version>4.4.0-SNAPSHOT</version>
2626
</parent>
2727

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

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

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import org.junit.jupiter.api.TestInfo
2323
import software.amazon.awssdk.core.sync.RequestBody
2424
import software.amazon.awssdk.services.s3.S3Client
2525
import software.amazon.awssdk.services.s3.model.BucketVersioningStatus
26-
import java.io.File
2726

2827
internal class ListObjectVersionsIT : S3TestBase() {
2928
private val s3Client: S3Client = createS3Client()
@@ -47,6 +46,43 @@ internal class ListObjectVersionsIT : S3TestBase() {
4746
RequestBody.fromFile(UPLOAD_FILE)
4847
).versionId()
4948

49+
val version2 = s3Client.putObject(
50+
{
51+
it.bucket(bucketName)
52+
it.key("$UPLOAD_FILE_NAME-1")
53+
},
54+
RequestBody.fromFile(UPLOAD_FILE)
55+
).versionId()
56+
57+
s3Client.listObjectVersions {
58+
it.bucket(bucketName)
59+
}.also {
60+
assertThat(it.versions())
61+
.hasSize(2)
62+
.extracting("versionId", "isLatest")
63+
.containsExactly(Tuple(version2, true), Tuple(version1, false))
64+
}
65+
}
66+
67+
@Test
68+
@S3VerifiedSuccess(year = 2025)
69+
fun listObjectVersions_differentObjects(testInfo: TestInfo) {
70+
val bucketName = givenBucket(testInfo)
71+
s3Client.putBucketVersioning {
72+
it.bucket(bucketName)
73+
it.versioningConfiguration {
74+
it.status(BucketVersioningStatus.ENABLED)
75+
}
76+
}
77+
78+
val version1 = s3Client.putObject(
79+
{
80+
it.bucket(bucketName)
81+
it.key("$UPLOAD_FILE_NAME-1")
82+
},
83+
RequestBody.fromFile(UPLOAD_FILE)
84+
).versionId()
85+
5086
val version2 = s3Client.putObject(
5187
{
5288
it.bucket(bucketName)
@@ -61,7 +97,7 @@ internal class ListObjectVersionsIT : S3TestBase() {
6197
assertThat(it.versions())
6298
.hasSize(2)
6399
.extracting("versionId", "isLatest")
64-
.containsExactlyInAnyOrder(Tuple(version1, true), Tuple(version2, true))
100+
.containsExactly(Tuple(version1, true), Tuple(version2, true))
65101
}
66102
}
67103

@@ -146,7 +182,7 @@ internal class ListObjectVersionsIT : S3TestBase() {
146182
assertThat(it.deleteMarkers())
147183
.hasSize(1)
148184
.extracting("key")
149-
.containsExactlyInAnyOrder("$UPLOAD_FILE_NAME-3")
185+
.containsExactly("$UPLOAD_FILE_NAME-3")
150186
}
151187
}
152188
}

pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<groupId>com.adobe.testing</groupId>
2323
<artifactId>s3mock-parent</artifactId>
24-
<version>4.3.1-SNAPSHOT</version>
24+
<version>4.4.0-SNAPSHOT</version>
2525
<packaging>pom</packaging>
2626

2727
<name>S3Mock - Parent</name>
@@ -108,6 +108,7 @@
108108
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
109109
<maven-clean-plugin.version>3.4.1</maven-clean-plugin.version>
110110
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
111+
<maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
111112
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
112113
<maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
113114
<maven-failsafe-plugin.version>3.5.3</maven-failsafe-plugin.version>
@@ -321,6 +322,11 @@
321322
<build>
322323
<pluginManagement>
323324
<plugins>
325+
<plugin>
326+
<groupId>org.apache.maven.plugins</groupId>
327+
<artifactId>maven-dependency-plugin</artifactId>
328+
<version>${maven-dependency-plugin.version}</version>
329+
</plugin>
324330
<plugin>
325331
<groupId>com.github.ekryd.sortpom</groupId>
326332
<artifactId>sortpom-maven-plugin</artifactId>
@@ -496,6 +502,7 @@
496502
<requireJavaVersion>
497503
<version>${java.version}</version>
498504
</requireJavaVersion>
505+
<!--dependencyConvergence/-->
499506
</rules>
500507
</configuration>
501508
</plugin>

server/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.3.1-SNAPSHOT</version>
25+
<version>4.4.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>s3mock</artifactId>

server/src/main/java/com/adobe/testing/s3mock/S3MockApplication.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 Adobe.
2+
* Copyright 2017-2025 Adobe.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@
2525
import org.springframework.boot.Banner;
2626
import org.springframework.boot.SpringApplication;
2727
import org.springframework.boot.autoconfigure.SpringBootApplication;
28-
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
2928
import org.springframework.boot.builder.SpringApplicationBuilder;
3029
import org.springframework.context.ConfigurableApplicationContext;
3130
import org.springframework.context.annotation.ComponentScan;
@@ -39,17 +38,7 @@
3938
/**
4039
* File Store Application that mocks Amazon S3.
4140
*/
42-
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class},
43-
/*
44-
* Also exclude ManagementWebSecurityAutoConfiguration, to prevent the
45-
* erroneous activation of the CsrfFilter, which would cause access denied
46-
* errors upon accesses when spring-boot-actuator is on the class path.
47-
* This may be due to a bug in Spring Boot 2.1.2+. For details see
48-
* https://github.com/adobe/S3Mock/issues/130
49-
*/
50-
excludeName = {"org.springframework.boot.actuate.autoconfigure.security.servlet."
51-
+ "ManagementWebSecurityAutoConfiguration"}
52-
)
41+
@SpringBootApplication
5342
@ComponentScan(excludeFilters = {
5443
/*
5544
* TypeFilter to exclude classes with annotations that inherit {@link Component} to be

server/src/main/java/com/adobe/testing/s3mock/service/BucketService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import com.adobe.testing.s3mock.store.BucketStore;
5757
import com.adobe.testing.s3mock.store.ObjectStore;
5858
import java.util.ArrayList;
59+
import java.util.Collections;
5960
import java.util.Comparator;
6061
import java.util.List;
6162
import java.util.Map;
@@ -290,7 +291,9 @@ public ListVersionsResult listVersions(String bucketName,
290291

291292
if (bucket.isVersioningEnabled()) {
292293
var s3ObjectVersions = objectStore.getS3ObjectVersions(bucket, id);
293-
for (var s3ObjectVersion : s3ObjectVersions.versions()) {
294+
var versions = new ArrayList<>(s3ObjectVersions.versions());
295+
Collections.reverse(versions);
296+
for (var s3ObjectVersion : versions) {
294297
var s3ObjectMetadata = objectStore.getS3ObjectMetadata(bucket, id, s3ObjectVersion);
295298
if (!s3ObjectMetadata.deleteMarker()) {
296299
if (objectVersions.size() > maxKeys) {

testsupport/common/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-testsupport-reactor</artifactId>
25-
<version>4.3.1-SNAPSHOT</version>
25+
<version>4.4.0-SNAPSHOT</version>
2626
</parent>
2727

2828
<artifactId>s3mock-testsupport-common</artifactId>

0 commit comments

Comments
 (0)