2828import ch .cyberduck .core .cryptomator .features .CryptoWriteFeature ;
2929import ch .cyberduck .core .features .Directory ;
3030import ch .cyberduck .core .features .Find ;
31+ import ch .cyberduck .core .features .Write ;
3132import ch .cyberduck .core .io .StreamCopier ;
3233import ch .cyberduck .core .pool .SessionPool ;
3334import ch .cyberduck .core .s3 .AbstractS3Test ;
@@ -107,10 +108,11 @@ public void testCopyToDifferentFolderCryptomator() throws Exception {
107108 final DefaultVaultRegistry registry = new DefaultVaultRegistry (new DisabledPasswordCallback (), cryptomator );
108109 session .withRegistry (registry );
109110 final S3AccessControlListFeature acl = new S3AccessControlListFeature (session );
110- new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), new S3WriteFeature (session , acl ), cryptomator ).touch (source , new TransferStatus ());
111+ new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), cryptomator ).touch (
112+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), source , new TransferStatus ());
111113 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (source ));
112-
113- cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature ( session , new S3WriteFeature (session , acl ), acl )). mkdir ( targetFolder , new TransferStatus ());
114+ cryptomator . getFeature ( session , Directory . class , new S3DirectoryFeature ( session , acl )). mkdir (
115+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), targetFolder , new TransferStatus ());
114116 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (targetFolder ));
115117 final CopyWorker worker = new CopyWorker (Collections .singletonMap (source , target ), new SessionPool .SingleSessionPool (session , registry ), PathCache .empty (), new DisabledProgressListener (), new DisabledConnectionCallback ());
116118 worker .run (session );
@@ -132,9 +134,9 @@ public void testCopyToDifferentFolderLongFilenameCryptomator() throws Exception
132134 final DefaultVaultRegistry registry = new DefaultVaultRegistry (new DisabledPasswordCallback (), cryptomator );
133135 session .withRegistry (registry );
134136 final S3AccessControlListFeature acl = new S3AccessControlListFeature (session );
135- new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), new S3WriteFeature (session , acl ), cryptomator ). touch ( source , new TransferStatus ());
137+ new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), cryptomator ). touch ( new S3WriteFeature (session , new S3AccessControlListFeature ( session )), source , new TransferStatus ());
136138 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (source ));
137- cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , new S3WriteFeature (session , acl ), acl )). mkdir ( targetFolder , new TransferStatus ());
139+ cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , acl )). mkdir ( new S3WriteFeature (session , new S3AccessControlListFeature ( session )), targetFolder , new TransferStatus ());
138140 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (targetFolder ));
139141 final CopyWorker worker = new CopyWorker (Collections .singletonMap (source , target ), new SessionPool .SingleSessionPool (session , registry ), PathCache .empty (), new DisabledProgressListener (), new DisabledConnectionCallback ());
140142 worker .run (session );
@@ -154,9 +156,11 @@ public void testCopyFolder() throws Exception {
154156 final DefaultVaultRegistry registry = new DefaultVaultRegistry (new DisabledPasswordCallback (), cryptomator );
155157 session .withRegistry (registry );
156158 final S3AccessControlListFeature acl = new S3AccessControlListFeature (session );
157- cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , new S3WriteFeature (session , acl ), acl )).mkdir (folder , new TransferStatus ());
159+ cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , acl )).mkdir (
160+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), folder , new TransferStatus ());
158161 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (folder ));
159- new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), new S3WriteFeature (session , acl ), cryptomator ).touch (file , new TransferStatus ());
162+ new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), cryptomator ).touch (
163+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), file , new TransferStatus ());
160164 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (file ));
161165 // copy file
162166 final Path fileRenamed = new Path (folder , "f1" , EnumSet .of (Path .Type .file ));
@@ -189,7 +193,8 @@ public void testCopyFileIntoVault() throws Exception {
189193 cryptomator .create (session , new VaultCredentials ("test" ), vaultVersion );
190194 final DefaultVaultRegistry registry = new DefaultVaultRegistry (new DisabledPasswordCallback (), cryptomator );
191195 session .withRegistry (registry );
192- cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , new S3WriteFeature (session , acl ), acl )).mkdir (encryptedFolder , new TransferStatus ());
196+ cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , acl )).mkdir (
197+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), encryptedFolder , new TransferStatus ());
193198 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (encryptedFolder ));
194199 // copy file into vault
195200 final CopyWorker worker = new CopyWorker (Collections .singletonMap (cleartextFile , encryptedFile ), new SessionPool .SingleSessionPool (session , registry ), PathCache .empty (), new DisabledProgressListener (), new DisabledConnectionCallback ());
@@ -210,8 +215,8 @@ public void testCopyDirectoryIntoVault() throws Exception {
210215 final Path cleartextFolder = new Path (home , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .directory ));
211216 final Path cleartextFile = new Path (cleartextFolder , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .file ));
212217 final S3AccessControlListFeature acl = new S3AccessControlListFeature (session );
213- new S3DirectoryFeature (session , new S3WriteFeature (session , acl ), acl ). mkdir ( cleartextFolder , new TransferStatus ());
214- new S3TouchFeature (session , acl ).touch (cleartextFile , new TransferStatus ());
218+ new S3DirectoryFeature (session , acl ). mkdir ( new S3WriteFeature (session , acl ), cleartextFolder , new TransferStatus ());
219+ new S3TouchFeature (session , acl ).touch (new S3WriteFeature ( session , acl ), cleartextFile , new TransferStatus ());
215220 assertTrue (new S3FindFeature (session , acl ).find (cleartextFolder ));
216221 assertTrue (new S3FindFeature (session , acl ).find (cleartextFile ));
217222 final CryptoVault cryptomator = new CryptoVault (vault );
@@ -237,17 +242,18 @@ public void testCopyFileOutsideVault() throws Exception {
237242 final Path vault = new Path (home , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .directory ));
238243 final Path clearFolder = new Path (home , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .directory ));
239244 final S3AccessControlListFeature acl = new S3AccessControlListFeature (session );
240- new S3DirectoryFeature (session , new S3WriteFeature (session , acl ),
241- acl ).mkdir (clearFolder , new TransferStatus ());
245+ new S3DirectoryFeature (session , acl ).mkdir (new S3WriteFeature (session , acl ), clearFolder , new TransferStatus ());
242246 final Path encryptedFolder = new Path (vault , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .directory ));
243247 final Path encryptedFile = new Path (encryptedFolder , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .file ));
244248 final CryptoVault cryptomator = new CryptoVault (vault );
245249 cryptomator .create (session , new VaultCredentials ("test" ), vaultVersion );
246250 final DefaultVaultRegistry registry = new DefaultVaultRegistry (new DisabledPasswordCallback (), cryptomator );
247251 session .withRegistry (registry );
248- cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , new S3WriteFeature (session , acl ), acl )).mkdir (encryptedFolder , new TransferStatus ());
252+ cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , acl )).mkdir (
253+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), encryptedFolder , new TransferStatus ());
249254 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (encryptedFolder ));
250- new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), new S3WriteFeature (session , acl ), cryptomator ).touch (encryptedFile , new TransferStatus ());
255+ new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), cryptomator ).touch (
256+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), encryptedFile , new TransferStatus ());
251257 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (encryptedFile ));
252258 // move file outside vault
253259 final Path cleartextFile = new Path (clearFolder , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .file ));
@@ -270,10 +276,10 @@ public void testCopyDirectoryOutsideVault() throws Exception {
270276 final DefaultVaultRegistry registry = new DefaultVaultRegistry (new DisabledPasswordCallback (), cryptomator );
271277 session .withRegistry (registry );
272278 final S3AccessControlListFeature acl = new S3AccessControlListFeature (session );
273- cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , new S3WriteFeature (session , acl ),
274- acl )).mkdir (encryptedFolder , new TransferStatus ());
279+ cryptomator .getFeature (session , Directory .class , new S3DirectoryFeature (session , acl )).mkdir (cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), encryptedFolder , new TransferStatus ());
275280 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (encryptedFolder ));
276- new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), new S3WriteFeature (session , acl ), cryptomator ).touch (encryptedFile , new TransferStatus ());
281+ new CryptoTouchFeature <>(session , new S3TouchFeature (session , acl ), cryptomator ).touch (
282+ cryptomator .getFeature (session , Write .class , new S3WriteFeature (session , acl )), encryptedFile , new TransferStatus ());
277283 assertTrue (cryptomator .getFeature (session , Find .class , new DefaultFindFeature (session )).find (encryptedFile ));
278284 // copy directory outside vault
279285 final Path cleartextFolder = new Path (home , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .directory ));
0 commit comments