Skip to content

Commit a2c5260

Browse files
chenkinsdkocher
authored andcommitted
Add test move UVF file.
1 parent 260b3ef commit a2c5260

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

s3/src/test/java/ch/cyberduck/core/cryptomator/UVFIntegrationTest.java

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import ch.cyberduck.core.features.AttributesFinder;
2121
import ch.cyberduck.core.features.Bulk;
2222
import ch.cyberduck.core.features.Delete;
23+
import ch.cyberduck.core.features.Move;
2324
import ch.cyberduck.core.features.Read;
2425
import ch.cyberduck.core.features.Write;
2526
import ch.cyberduck.core.io.StatusOutputStream;
@@ -41,8 +42,6 @@
4142
import org.apache.commons.lang3.RandomUtils;
4243
import org.cryptomator.cryptolib.api.UVFMasterkey;
4344
import org.jetbrains.annotations.NotNull;
44-
import org.junit.AfterClass;
45-
import org.junit.BeforeClass;
4645
import org.junit.Test;
4746
import org.junit.experimental.categories.Category;
4847
import org.testcontainers.containers.ComposeContainer;
@@ -80,15 +79,6 @@ public class UVFIntegrationTest {
8079
).collect(Collectors.toMap(AbstractMap.SimpleImmutableEntry::getKey, AbstractMap.SimpleImmutableEntry::getValue)))
8180
.withExposedService("minio-1", 9000, Wait.forListeningPort());
8281

83-
@BeforeClass
84-
public static void start() {
85-
container.start();
86-
}
87-
88-
@AfterClass
89-
public static void shutdown() {
90-
container.stop();
91-
}
9282

9383
@Test
9484
public void listMinio() throws BackgroundException, IOException {
@@ -190,6 +180,28 @@ public Credentials prompt(final Host bookmark, final String title, final String
190180

191181
assertEquals(new String(expected), readFile(storage, new Path("/cyberduckbucket/subdir/alice.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted))));
192182
}
183+
{
184+
storage.getFeature(Delete.class).delete(Collections.singletonList(new Path("/cyberduckbucket/subdir/bar.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted))), new DisabledPasswordCallback(), new Delete.DisabledCallback());
185+
final AttributedList<Path> list = storage.getFeature(ListService.class).list(new Path("/cyberduckbucket/subdir", EnumSet.of(AbstractPath.Type.directory, AbstractPath.Type.placeholder, AbstractPath.Type.decrypted)), new DisabledListProgressListener());
186+
assertEquals(1, list.size());
187+
assertTrue(Arrays.toString(list.toArray()), list.contains(new Path("/cyberduckbucket/subdir/alice.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted))));
188+
}
189+
{
190+
storage.getFeature(Move.class).move(
191+
new Path("/cyberduckbucket/foo.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted)),
192+
new Path("/cyberduckbucket/subdir/Dave.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted)),
193+
new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback()
194+
);
195+
196+
final AttributedList<Path> listSubDir = storage.getFeature(ListService.class).list(new Path("/cyberduckbucket/subdir", EnumSet.of(AbstractPath.Type.directory, AbstractPath.Type.placeholder, AbstractPath.Type.decrypted)), new DisabledListProgressListener());
197+
assertEquals(2, listSubDir.size());
198+
assertTrue(Arrays.toString(listSubDir.toArray()), listSubDir.contains(new Path("/cyberduckbucket/subdir/alice.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted))));
199+
assertTrue(Arrays.toString(listSubDir.toArray()), listSubDir.contains(new Path("/cyberduckbucket/subdir/Dave.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted))));
200+
final AttributedList<Path> listHome = storage.getFeature(ListService.class).list(new Path("/cyberduckbucket/", EnumSet.of(AbstractPath.Type.directory, AbstractPath.Type.placeholder, AbstractPath.Type.decrypted)), new DisabledListProgressListener());
201+
assertEquals(2, listHome.size());
202+
assertTrue(Arrays.toString(listHome.toArray()), listHome.contains(new Path("/cyberduckbucket/alice.txt", EnumSet.of(AbstractPath.Type.file, AbstractPath.Type.decrypted))));
203+
assertTrue(Arrays.toString(listHome.toArray()), listHome.contains(new Path("/cyberduckbucket/subdir", EnumSet.of(AbstractPath.Type.directory, AbstractPath.Type.placeholder, AbstractPath.Type.decrypted))));
204+
}
193205
}
194206
finally {
195207
storage.withRegistry(new DefaultVaultRegistry(new DisabledPasswordCallback()));

0 commit comments

Comments
 (0)