3434import java .util .HashMap ;
3535import java .util .Map ;
3636
37- import static org .junit .Assert .assertEquals ;
37+ import static org .junit .Assert .* ;
3838
3939@ Category (IntegrationTest .class )
4040public 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