Skip to content

Commit c4b81cf

Browse files
committed
Add test.
1 parent 0829923 commit c4b81cf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

s3/src/test/java/ch/cyberduck/core/s3/S3TimestampFeatureTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@
3434
import java.util.HashMap;
3535
import java.util.Map;
3636

37-
import static org.junit.Assert.assertEquals;
37+
import static org.junit.Assert.*;
3838

3939
@Category(IntegrationTest.class)
4040
public class S3TimestampFeatureTest extends AbstractS3Test {
4141

4242
@Test
4343
public void testFindTimestamp() throws Exception {
44-
final Path bucket = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory));
44+
final Path bucket = new Path("versioning-test-eu-central-1-cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory));
4545
final TransferStatus status = new TransferStatus();
4646
final S3AccessControlListFeature acl = new S3AccessControlListFeature(session);
4747
final Path test = new S3TouchFeature(session, acl).touch(new Path(bucket,
48-
new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)),
48+
new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)),
4949
status
5050
.withCreated(1695159781972L)
5151
.withModified(1530305150672L));
@@ -54,9 +54,17 @@ public void testFindTimestamp() throws Exception {
5454
final PathAttributes attributes = new S3AttributesFinderFeature(session, acl).find(test);
5555
assertEquals(1530305150000L, attributes.getModificationDate());
5656
assertEquals(1695159781000L, attributes.getCreationDate());
57+
final Map<String, String> metadata = attributes.getMetadata();
58+
assertEquals(3, metadata.size());
59+
assertTrue(metadata.containsKey("mtime"));
60+
assertTrue(metadata.containsKey("btime"));
61+
assertTrue(metadata.containsKey("Content-Type"));
5762
final S3TimestampFeature feature = new S3TimestampFeature(session);
5863
feature.setTimestamp(test, new TransferStatus().withModified(1630305150672L).withCreated(1530305160672L));
5964
final PathAttributes attributesAfterSettingNewTimestamps = new S3AttributesFinderFeature(session, acl).find(test);
65+
assertNotEquals(metadata, attributesAfterSettingNewTimestamps.getMetadata());
66+
assertEquals(metadata.size(), attributesAfterSettingNewTimestamps.getMetadata().size());
67+
assertEquals(new S3AttributesFinderFeature(session, acl).find(test).getVersionId(), attributesAfterSettingNewTimestamps.getVersionId());
6068
assertEquals(1630305150000L, attributesAfterSettingNewTimestamps.getModificationDate());
6169
assertEquals(1530305160000L, attributesAfterSettingNewTimestamps.getCreationDate());
6270
test.attributes().setModificationDate(1630305150000L);

0 commit comments

Comments
 (0)