1717 * Bug fixes, suggestions and comments should be sent to [email protected] 1818 */
1919
20+ import ch .cyberduck .core .Acl ;
2021import ch .cyberduck .core .AlphanumericRandomStringService ;
2122import ch .cyberduck .core .DisabledLoginCallback ;
2223import ch .cyberduck .core .Path ;
@@ -69,18 +70,25 @@ public void testGetMetadataFile() throws Exception {
6970 public void testSetMetadataFileLeaveOtherFeatures () throws Exception {
7071 final Path container = new Path ("test-eu-central-1-cyberduck" , EnumSet .of (Path .Type .volume , Path .Type .directory ));
7172 final Path test = new Path (container , UUID .randomUUID ().toString (), EnumSet .of (Path .Type .file ));
72- new S3TouchFeature (session , new S3AccessControlListFeature (session )).touch (test , new TransferStatus ());
73- final S3MetadataFeature feature = new S3MetadataFeature (session , new S3AccessControlListFeature (session ));
73+ final S3AccessControlListFeature acls = new S3AccessControlListFeature (session );
74+ new S3TouchFeature (session , acls ).touch (test , new TransferStatus ());
75+ final S3MetadataFeature feature = new S3MetadataFeature (session , acls );
7476 final Map <String , String > reference = feature .getMetadata (test );
7577
7678 final String v = UUID .randomUUID ().toString ();
7779
78- final S3StorageClassFeature storage = new S3StorageClassFeature (session , new S3AccessControlListFeature (session ));
80+ final Acl acl = acls .getPermission (test );
81+ acl .addAll (new Acl .GroupUser (Acl .GroupUser .EVERYONE ), new Acl .Role (Acl .Role .READ ));
82+ acl .addAll (new Acl .GroupUser (Acl .GroupUser .AUTHENTICATED ), new Acl .Role (Acl .Role .READ ));
83+ acls .setPermission (test , acl );
84+ assertEquals (reference , feature .getMetadata (test ));
85+
86+ final S3StorageClassFeature storage = new S3StorageClassFeature (session , acls );
7987 storage .setClass (test , S3Object .STORAGE_CLASS_REDUCED_REDUNDANCY );
8088 assertEquals (S3Object .STORAGE_CLASS_REDUCED_REDUNDANCY , storage .getClass (test ));
8189 assertEquals (reference , feature .getMetadata (test ));
8290
83- final S3EncryptionFeature encryption = new S3EncryptionFeature (session , new S3AccessControlListFeature ( session ) );
91+ final S3EncryptionFeature encryption = new S3EncryptionFeature (session , acls );
8492 encryption .setEncryption (test , S3EncryptionFeature .SSE_AES256 );
8593 assertEquals ("AES256" , encryption .getEncryption (test ).algorithm );
8694 assertEquals (reference , feature .getMetadata (test ));
@@ -94,6 +102,7 @@ public void testSetMetadataFileLeaveOtherFeatures() throws Exception {
94102
95103 assertEquals (S3Object .STORAGE_CLASS_REDUCED_REDUNDANCY , storage .getClass (test ));
96104 assertEquals ("AES256" , encryption .getEncryption (test ).algorithm );
105+ assertEquals (acl , acls .getPermission (test ));
97106
98107 new S3DefaultDeleteFeature (session ).delete (Collections .singletonList (test ), new DisabledLoginCallback (), new Delete .DisabledCallback ());
99108 }
0 commit comments