|
4 | 4 |
|
5 | 5 | package ch.iterate.hub.core; |
6 | 6 |
|
7 | | -import ch.cyberduck.core.AbstractPath; |
8 | | -import ch.cyberduck.core.AttributedList; |
9 | | -import ch.cyberduck.core.DisabledCancelCallback; |
10 | | -import ch.cyberduck.core.DisabledHostKeyCallback; |
11 | | -import ch.cyberduck.core.DisabledListProgressListener; |
12 | | -import ch.cyberduck.core.DisabledLoginCallback; |
13 | | -import ch.cyberduck.core.DisabledPasswordCallback; |
14 | | -import ch.cyberduck.core.Host; |
15 | | -import ch.cyberduck.core.ListService; |
16 | | -import ch.cyberduck.core.Path; |
17 | | -import ch.cyberduck.core.Protocol; |
18 | | -import ch.cyberduck.core.ProtocolFactory; |
19 | | -import ch.cyberduck.core.Session; |
20 | | -import ch.cyberduck.core.SimplePathPredicate; |
| 7 | +import ch.cyberduck.core.*; |
| 8 | +import ch.cyberduck.core.features.Bulk; |
21 | 9 | import ch.cyberduck.core.features.Home; |
| 10 | +import ch.cyberduck.core.features.Touch; |
22 | 11 | import ch.cyberduck.core.features.Vault; |
| 12 | +import ch.cyberduck.core.features.Write; |
| 13 | +import ch.cyberduck.core.io.ChecksumComputeFactory; |
| 14 | +import ch.cyberduck.core.io.HashAlgorithm; |
| 15 | +import ch.cyberduck.core.io.StatusOutputStream; |
23 | 16 | import ch.cyberduck.core.preferences.PreferencesFactory; |
24 | 17 | import ch.cyberduck.core.proxy.DisabledProxyFinder; |
25 | 18 | import ch.cyberduck.core.ssl.DefaultX509KeyManager; |
26 | 19 | import ch.cyberduck.core.ssl.DisabledX509TrustManager; |
| 20 | +import ch.cyberduck.core.transfer.Transfer; |
| 21 | +import ch.cyberduck.core.transfer.TransferItem; |
| 22 | +import ch.cyberduck.core.transfer.TransferStatus; |
27 | 23 | import ch.cyberduck.core.vault.DefaultVaultRegistry; |
28 | 24 |
|
| 25 | +import org.apache.commons.io.IOUtils; |
| 26 | +import org.apache.commons.lang3.RandomUtils; |
29 | 27 | import org.apache.commons.lang3.StringUtils; |
30 | 28 | import org.apache.logging.log4j.LogManager; |
31 | 29 | import org.apache.logging.log4j.Logger; |
32 | 30 | import org.junit.jupiter.api.Assertions; |
| 31 | +import org.junit.jupiter.api.Disabled; |
| 32 | +import org.junit.jupiter.api.Test; |
33 | 33 | import org.junit.jupiter.params.ParameterizedTest; |
34 | 34 | import org.openapitools.jackson.nullable.JsonNullableModule; |
35 | 35 |
|
| 36 | +import java.io.ByteArrayInputStream; |
| 37 | +import java.util.Collections; |
36 | 38 | import java.util.EnumSet; |
37 | 39 | import java.util.List; |
38 | 40 | import java.util.UUID; |
|
58 | 60 | import com.fasterxml.jackson.annotation.JsonInclude; |
59 | 61 | import com.fasterxml.jackson.databind.ObjectMapper; |
60 | 62 |
|
| 63 | +import org.testcontainers.shaded.org.apache.commons.io.input.NullInputStream; |
| 64 | + |
61 | 65 | import static ch.iterate.hub.testsetup.HubTestUtilities.getAdminApiClient; |
62 | 66 | import static org.junit.jupiter.api.Assertions.*; |
63 | 67 |
|
64 | 68 | public abstract class AbstractHubSynchronizeTest extends AbstractHubTest { |
65 | 69 | private static final Logger log = LogManager.getLogger(AbstractHubSynchronizeTest.class.getName()); |
66 | 70 |
|
| 71 | + /** |
| 72 | + * Use to start unattended setup and then run |
| 73 | + * @throws InterruptedException |
| 74 | + */ |
| 75 | + @Test |
| 76 | + @Disabled |
| 77 | + public void runForever() throws InterruptedException { |
| 78 | + Thread.sleep(924982347); |
| 79 | + } |
| 80 | + |
67 | 81 | /** |
68 | 82 | * Verify storage profiles are synced from hub bookmark. |
69 | 83 | */ |
@@ -249,6 +263,19 @@ public void test03AddVault(final HubTestConfig config) throws Exception { |
249 | 263 | final AttributedList<Path> list = session.getFeature(ListService.class).list(bucket, new DisabledListProgressListener()); |
250 | 264 | assertTrue(list.isEmpty()); |
251 | 265 | } |
| 266 | + { |
| 267 | + final Path home = vaultRegistry.find(session, bucket).getHome(); |
| 268 | + Path file = new Path(home, "gugus.txt", EnumSet.of(AbstractPath.Type.file)); |
| 269 | + byte[] content = RandomUtils.nextBytes(234); |
| 270 | + TransferStatus transferStatus = new TransferStatus().withLength(content.length); |
| 271 | + transferStatus.setChecksum(session.getFeature(Write.class).checksum(file, transferStatus).compute(new ByteArrayInputStream(content), transferStatus)); |
| 272 | + session.getFeature(Bulk.class).pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(file), transferStatus), new DisabledConnectionCallback()); |
| 273 | + StatusOutputStream<?> out = session.getFeature(Write.class).write(file, transferStatus, new DisabledConnectionCallback()); |
| 274 | + IOUtils.copyLarge(new ByteArrayInputStream(content), out); |
| 275 | + out.close(); |
| 276 | + final AttributedList<Path> list = session.getFeature(ListService.class).list(bucket, new DisabledListProgressListener()); |
| 277 | + assertFalse(list.isEmpty()); |
| 278 | + } |
252 | 279 |
|
253 | 280 | // raw listing encrypted file names |
254 | 281 | vaultRegistry.close(bucket); |
|
0 commit comments