diff --git a/ctera/src/main/java/ch/cyberduck/core/ctera/CteraDelegatingReadFeature.java b/ctera/src/main/java/ch/cyberduck/core/ctera/CteraDelegatingReadFeature.java index 8c10d55d0e..10e8cc4696 100644 --- a/ctera/src/main/java/ch/cyberduck/core/ctera/CteraDelegatingReadFeature.java +++ b/ctera/src/main/java/ch/cyberduck/core/ctera/CteraDelegatingReadFeature.java @@ -19,7 +19,6 @@ import ch.cyberduck.core.ConnectionCallback; import ch.cyberduck.core.Path; import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.features.Read; -import ch.cyberduck.core.features.VersionIdProvider; import ch.cyberduck.core.preferences.HostPreferencesFactory; import ch.cyberduck.core.transfer.TransferStatus; @@ -33,12 +32,10 @@ public class CteraDelegatingReadFeature implements Read { private static final Logger log = LogManager.getLogger(CteraDelegatingReadFeature.class); private final CteraSession session; - private final VersionIdProvider versionid; private final boolean directio; - public CteraDelegatingReadFeature(final CteraSession session, final VersionIdProvider versionid) { + public CteraDelegatingReadFeature(final CteraSession session) { this.session = session; - this.versionid = versionid; this.directio = HostPreferencesFactory.get(session.getHost()).getBoolean("ctera.download.directio.enable"); } diff --git a/ctera/src/main/java/ch/cyberduck/core/ctera/CteraSession.java b/ctera/src/main/java/ch/cyberduck/core/ctera/CteraSession.java index 4e38a7cb8a..97dc95adc5 100644 --- a/ctera/src/main/java/ch/cyberduck/core/ctera/CteraSession.java +++ b/ctera/src/main/java/ch/cyberduck/core/ctera/CteraSession.java @@ -277,7 +277,7 @@ public class CteraSession extends DAVSession { return (T) new CteraListService(this); } if(type == Read.class) { - return (T) new CteraDelegatingReadFeature(this, versionid); + return (T) new CteraDelegatingReadFeature(this); } if(type == Write.class) { return (T) new CteraWriteFeature(this); diff --git a/ctera/src/main/java/ch/cyberduck/core/ctera/README.md b/ctera/src/main/java/ch/cyberduck/core/ctera/README.md index 208e6c756a..24adc15c03 100644 --- a/ctera/src/main/java/ch/cyberduck/core/ctera/README.md +++ b/ctera/src/main/java/ch/cyberduck/core/ctera/README.md @@ -84,12 +84,12 @@ N.B. no need to check `readpermission` upon mv/cp. | ACL (CTERA) | POSIX (Folder) | POSIX (File) | Windows `FileSystemRights` (Folder) | Windows `FileSystemRights` (File) | Example (Folder) | Example (File) | |----------------------------------------------------------------------------------------|-----------------------------------------------------|--------------------------------------|-----------------------------------------------------------|-----------------------------------|-----------------------------------------------------------------|--------------------------------------------------------------| -| - | `---` | - | empty | - | `/ACL test (new user)/NoAccess/` | - | -| `readpermission` | `r-x` | `r--` | `ReadAndExecute` | `Read` | `/ACL test (new user)/ReadOnly/` | `/ACL test (new user)/ReadOnly/ReadOnly.txt` | -| `readpermission`, `createdirectoriespermission` | `rwx` (delete prevented in preflight) | - | `ReadAndExecute`, `CreateDirectories`, `CreateFiles` (!), | - | `/WORM test (new user)/Retention Folder (no write, no delete)/` | - | -| `readpermission`, `deletepermission` | `rwx` (folder/file creation prevented in preflight) | `rw-` (write prevented in preflight) | `ReadAndExecute`, `Delete` | `Read`, `Delete` | `/ACL test (new user)/NoCreateFolderPermission` | `/ACL test (new user)/NoCreateFolderPermission/trayIcon.png` | -| `readpermission`, `deletepermission`, `writepermission` | - | `rwx` | - | `Read`, `Delete`, `Write` | - | `/ACL test (new user)/ReadWrite/Free Access.txt` | -| `readpermission`, `deletepermission`, `writepermission`, `createdirectoriespermission` | `rwx` | - | `ReadAndExecute`, `Delete`, `Write` | - | `/ACL test (new user)/ReadWrite/` | - | +| - | `---` | - | empty | - | `/ACL test/NoAccess/` | - | +| `readpermission` | `r-x` | `r--` | `ReadAndExecute` | `Read` | `/ACL test/ReadOnly/` | `/ACL test/ReadOnly/ReadOnly.txt` | +| `readpermission`, `createdirectoriespermission` | `rwx` (delete prevented in preflight) | - | `ReadAndExecute`, `CreateDirectories`, `CreateFiles` (!), | - | `/WORM test/Retention Folder (no write, no delete)/` | - | +| `readpermission`, `deletepermission` | `rwx` (folder/file creation prevented in preflight) | `rw-` (write prevented in preflight) | `ReadAndExecute`, `Delete` | `Read`, `Delete` | `/ACL test/NoCreateFolderPermission` | `/ACL test/NoCreateFolderPermission/trayIcon.png` | +| `readpermission`, `deletepermission`, `writepermission` | - | `rwx` | - | `Read`, `Delete`, `Write` | - | `/ACL test/ReadWrite/Free Access.txt` | +| `readpermission`, `deletepermission`, `writepermission`, `createdirectoriespermission` | `rwx` | - | `ReadAndExecute`, `Delete`, `Write` | - | `/ACL test/ReadWrite/` | - | #### References diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/AbstractCteraDirectIOTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/AbstractCteraDirectIOTest.java deleted file mode 100644 index d6fa155210..0000000000 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/AbstractCteraDirectIOTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package ch.cyberduck.core.ctera; - -/* - * Copyright (c) 2002-2022 iterate GmbH. All rights reserved. - * https://cyberduck.io/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -import ch.cyberduck.core.Credentials; -import ch.cyberduck.core.Host; -import ch.cyberduck.core.HostKeyCallback; -import ch.cyberduck.core.LoginCallback; -import ch.cyberduck.core.LoginConnectionService; -import ch.cyberduck.core.ProgressListener; -import ch.cyberduck.core.proxy.DisabledProxyFinder; -import ch.cyberduck.core.ssl.DefaultX509KeyManager; -import ch.cyberduck.core.ssl.DisabledX509TrustManager; -import ch.cyberduck.core.threading.CancelCallback; -import ch.cyberduck.test.VaultTest; - -import org.junit.After; -import org.junit.Before; - -public class AbstractCteraDirectIOTest extends VaultTest { - - protected CteraSession session; - private TestPasswordStore keychain; - - @After - public void disconnect() throws Exception { - session.close(); - keychain.save(session.getHost()); - } - - @Before - public void setup() throws Exception { - final Host host = new Host(new CteraProtocol(), "dcdirect.ctera.me", new Credentials(PROPERTIES.get("ctera.directio.user"))) { - @Override - public String getProperty(final String key) { - if("ctera.download.directio.enable".equals(key)) { - return String.valueOf(true); - } - return super.getProperty(key); - } - }; - host.setDefaultPath("/ServicesPortal/webdav/My Files"); - keychain = new TestPasswordStore(); - session = new CteraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager(), keychain); - final LoginConnectionService connect = new LoginConnectionService(LoginCallback.noop, HostKeyCallback.noop, - keychain, ProgressListener.noop, new DisabledProxyFinder()); - connect.check(session, CancelCallback.noop); - } -} diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/AbstractCteraTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/AbstractCteraTest.java index aaac4b6459..4412965d7e 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/AbstractCteraTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/AbstractCteraTest.java @@ -43,7 +43,15 @@ public class AbstractCteraTest extends VaultTest { @Before public void setup() throws Exception { - final Host host = new Host(new CteraProtocol(), "driveconnect.ctera.me", new Credentials(PROPERTIES.get("ctera.user"))); + final Host host = new Host(new CteraProtocol(), PROPERTIES.get("ctera.hostname"), new Credentials(PROPERTIES.get("ctera.user"))) { + @Override + public String getProperty(final String key) { + if("ctera.download.directio.enable".equals(key)) { + return String.valueOf(true); + } + return super.getProperty(key); + } + }; host.setDefaultPath("/ServicesPortal/webdav/My Files"); session = new CteraSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()); final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() { diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraAttributesFinderFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraAttributesFinderFeatureTest.java index a8c6061bf6..4e3856fb9c 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraAttributesFinderFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraAttributesFinderFeatureTest.java @@ -108,7 +108,7 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { @Test public void testNoAccessAcl() throws Exception { - final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test (new user)", EnumSet.of(AbstractPath.Type.directory)); + final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test", EnumSet.of(AbstractPath.Type.directory)); // list parent folder to inspect attributes final List noAccess = new CteraListService(session).propfind(home).stream().filter(r -> r.getName().equals("NoAccess")).collect(Collectors.toList()); @@ -119,8 +119,8 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { assertEquals("false", resource.getCustomProps().get(READPERMISSION.getName())); assertEquals("false", resource.getCustomProps().get(DELETEPERMISSION.getName())); assertEquals("false", resource.getCustomProps().get(CREATEDIRECTORIESPERMISSION.getName())); - assertEquals("bb64b3a4-399e-45d0-95af-43f1ace6e250:105620641", resource.getCustomProps().get(CTERA_GUID)); - assertEquals("105620644", resource.getCustomProps().get(CTERA_FILEID)); + assertEquals("05c75d64-bb1e-4be8-8ec3-19370247dfec:913", resource.getCustomProps().get(CTERA_GUID)); + assertEquals("47836", resource.getCustomProps().get(CTERA_FILEID)); assertEquals(new Acl(new Acl.CanonicalUser()), new CteraAttributesFinderFeature(session).toAttributes(resource).getAcl()); // find fails with 403 in backend final AccessDeniedException findException = assertThrows(AccessDeniedException.class, () -> new CteraAttributesFinderFeature(session).find(new Path(home, "NoAccess", EnumSet.of(AbstractPath.Type.directory)))); @@ -133,10 +133,12 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { @Test public void testNoDeleteAcl() throws Exception { - final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test (new user)", EnumSet.of(AbstractPath.Type.directory)); + final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test", EnumSet.of(AbstractPath.Type.directory)); final Path folder = new Path(home, "NoDelete", EnumSet.of(AbstractPath.Type.directory)); final Acl folderAcl = new CteraAttributesFinderFeature(session).find(folder).getAcl(); - assertEquals(new Acl(new Acl.UserAndRole(new Acl.CanonicalUser(), READPERMISSION)), folderAcl); + assertEquals(new Acl(new Acl.UserAndRole(new Acl.CanonicalUser(), READPERMISSION), + new Acl.UserAndRole(new Acl.CanonicalUser(), WRITEPERMISSION), + new Acl.UserAndRole(new Acl.CanonicalUser(), CREATEDIRECTORIESPERMISSION)), folderAcl); final Path file = new Path(folder, "RW no delete.txt", EnumSet.of(AbstractPath.Type.file)); final Acl fileAcl = new CteraAttributesFinderFeature(session).find(file).getAcl(); @@ -145,7 +147,7 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { @Test public void testReadOnlyAcl() throws Exception { - final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test (new user)", EnumSet.of(AbstractPath.Type.directory)); + final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test", EnumSet.of(AbstractPath.Type.directory)); final Path folder = new Path(home, "ReadOnly", EnumSet.of(AbstractPath.Type.directory)); final Acl folderAcl = new CteraAttributesFinderFeature(session).find(folder).getAcl(); assertEquals(new Acl(new Acl.UserAndRole(new Acl.CanonicalUser(), READPERMISSION)), folderAcl); @@ -157,7 +159,7 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { @Test public void testNoCreateFolderAcl() throws Exception { - final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test (new user)", EnumSet.of(AbstractPath.Type.directory)); + final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test", EnumSet.of(AbstractPath.Type.directory)); final Path folder = new Path(home, "NoCreateFolderPermission", EnumSet.of(AbstractPath.Type.directory)); final Acl folderAcl = new CteraAttributesFinderFeature(session).find(folder).getAcl(); assertEquals(new Acl( @@ -176,7 +178,7 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { @Test public void testReadWriteAcl() throws Exception { - final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test (new user)", EnumSet.of(AbstractPath.Type.directory)); + final Path home = new Path("/ServicesPortal/webdav/Shared With Me/ACL test", EnumSet.of(AbstractPath.Type.directory)); final Path folder = new Path(home, "ReadWrite", EnumSet.of(AbstractPath.Type.directory)); final Acl folderAcl = new CteraAttributesFinderFeature(session).find(folder).getAcl(); assertEquals(new Acl( @@ -206,15 +208,7 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { @Test public void testWORMAcl() throws Exception { final Path home = new Path("/ServicesPortal/webdav/Shared With Me", EnumSet.of(AbstractPath.Type.directory)); - final Path folder = new Path(home, "WORM test (new user)", EnumSet.of(AbstractPath.Type.directory)); - final Acl folderAcl = new CteraAttributesFinderFeature(session).find(folder).getAcl(); - assertEquals(new Acl( - new Acl.UserAndRole(new Acl.CanonicalUser(), READPERMISSION), - new Acl.UserAndRole(new Acl.CanonicalUser(), WRITEPERMISSION), - new Acl.UserAndRole(new Acl.CanonicalUser(), DELETEPERMISSION), - new Acl.UserAndRole(new Acl.CanonicalUser(), CREATEDIRECTORIESPERMISSION) - ), folderAcl); - + final Path folder = new Path(home, "WORM test", EnumSet.of(AbstractPath.Type.directory)); final Path subfolder = new Path(folder, "Retention Folder (no write, no delete)", EnumSet.of(AbstractPath.Type.directory)); final Acl subfolderAcl = new CteraAttributesFinderFeature(session).find(subfolder).getAcl(); assertEquals(new Acl( @@ -227,26 +221,14 @@ public class CteraAttributesFinderFeatureTest extends AbstractCteraTest { assertEquals(new Acl( new Acl.UserAndRole(new Acl.CanonicalUser(), READPERMISSION) ), fileAcl); - - final Path emptySubfolder = new Path(folder, "Empty WORM folder", EnumSet.of(AbstractPath.Type.directory)); - final Acl emptySubfolderAcl = new CteraAttributesFinderFeature(session).find(emptySubfolder).getAcl(); - assertEquals(new Acl( - new Acl.UserAndRole(new Acl.CanonicalUser(), READPERMISSION), - new Acl.UserAndRole(new Acl.CanonicalUser(), CREATEDIRECTORIESPERMISSION) - ), emptySubfolderAcl); } @Test public void testWORMNoRetentionAcl() throws Exception { final Path home = new Path("/ServicesPortal/webdav/Shared With Me", EnumSet.of(AbstractPath.Type.directory)); - final Path folder = new Path(home, "WORM-NoRetention(Delete allowed) (new user)", EnumSet.of(AbstractPath.Type.directory)); + final Path folder = new Path(home, "WORM-NoRetention(Delete allowed)", EnumSet.of(AbstractPath.Type.directory)); final Acl folderAcl = new CteraAttributesFinderFeature(session).find(folder).getAcl(); - assertEquals(new Acl( - new Acl.UserAndRole(new Acl.CanonicalUser(), READPERMISSION), - new Acl.UserAndRole(new Acl.CanonicalUser(), WRITEPERMISSION), - new Acl.UserAndRole(new Acl.CanonicalUser(), DELETEPERMISSION), - new Acl.UserAndRole(new Acl.CanonicalUser(), CREATEDIRECTORIESPERMISSION) - ), folderAcl); + assertEquals(Acl.EMPTY, folderAcl); final Path file = new Path(folder, "WORM-DeleteAllowed.txt", EnumSet.of(AbstractPath.Type.file)); final Acl fileAcle = new CteraAttributesFinderFeature(session).find(file).getAcl(); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java index e3c1fefd93..41d1a16040 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraConcurrentTransferWorkerTest.java @@ -58,7 +58,7 @@ import java.util.EnumSet; import static org.junit.Assert.*; @Category(IntegrationTest.class) -public class CteraConcurrentTransferWorkerTest extends AbstractCteraDirectIOTest { +public class CteraConcurrentTransferWorkerTest extends AbstractCteraTest { @Test public void testBelowSegmentSizeUpAndDownload() throws Exception { diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDeleteFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDeleteFeatureTest.java index 275ba047af..2342df4add 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDeleteFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDeleteFeatureTest.java @@ -5,11 +5,8 @@ import ch.cyberduck.core.AlphanumericRandomStringService; import ch.cyberduck.core.LoginCallback; import ch.cyberduck.core.Path; import ch.cyberduck.core.dav.DAVFindFeature; -import ch.cyberduck.core.dav.DAVLockFeature; import ch.cyberduck.core.exception.AccessDeniedException; -import ch.cyberduck.core.exception.InteroperabilityException; import ch.cyberduck.core.exception.NotfoundException; -import ch.cyberduck.core.exception.RetriableAccessDeniedException; import ch.cyberduck.core.features.Delete; import ch.cyberduck.core.shared.DefaultHomeFinderService; import ch.cyberduck.core.transfer.TransferStatus; @@ -37,22 +34,6 @@ public class CteraDeleteFeatureTest extends AbstractCteraTest { assertFalse(new DAVFindFeature(session).find(test)); } - @Test(expected = RetriableAccessDeniedException.class) - public void testDeleteFileWithLock() throws Exception { - final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); - new CteraTouchFeature(session).touch(new CteraWriteFeature(session), test, new TransferStatus()); - String lock = null; - try { - lock = new DAVLockFeature(session).lock(test); - } - catch(InteroperabilityException e) { - // Not supported - } - assertTrue(new DAVFindFeature(session).find(test)); - new CteraDeleteFeature(session).delete(Collections.singletonMap(test, new TransferStatus().setLockId(lock)), LoginCallback.noop, new Delete.DisabledCallback()); - assertFalse(new DAVFindFeature(session).find(test)); - } - @Test public void testDeleteDirectory() throws Exception { final Path test = new Path(new DefaultHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); diff --git a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java index 4067eb5400..ad928f030b 100644 --- a/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java +++ b/ctera/src/test/java/ch/cyberduck/core/ctera/CteraDirectIOReadFeatureTest.java @@ -50,7 +50,7 @@ import java.util.EnumSet; import static org.junit.Assert.*; @Category(IntegrationTest.class) -public class CteraDirectIOReadFeatureTest extends AbstractCteraDirectIOTest { +public class CteraDirectIOReadFeatureTest extends AbstractCteraTest { @Test public void testReadSingleChunk() throws Exception {