mirror of
https://github.com/iterate-ch/cyberduck.git
synced 2026-05-26 19:10:49 +00:00
Extract interface.
This commit is contained in:
@@ -16,6 +16,7 @@ package ch.cyberduck.core.azure;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.CancellingListProgressListener;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DirectoryDelimiterPathContainerService;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -62,7 +63,7 @@ public class AzureAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
}
|
||||
try {
|
||||
if(containerService.isContainer(file)) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
final BlobContainerClient client = session.getClient().getBlobContainerClient(containerService.getContainer(file).getName());
|
||||
final BlobContainerProperties properties = client.getProperties();
|
||||
attributes.setETag(properties.getETag());
|
||||
@@ -105,7 +106,7 @@ public class AzureAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
}
|
||||
|
||||
public PathAttributes toAttributes(final BlobProperties properties) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(properties.getBlobSize());
|
||||
attributes.setModificationDate(properties.getLastModified().toInstant().toEpochMilli());
|
||||
if(properties.getContentMd5() != null) {
|
||||
@@ -119,7 +120,7 @@ public class AzureAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
}
|
||||
|
||||
public PathAttributes toAttributes(final BlobItemProperties properties) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(properties.getContentLength());
|
||||
attributes.setModificationDate(properties.getLastModified().toInstant().toEpochMilli());
|
||||
attributes.setETag(properties.getETag());
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.azure;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -46,7 +47,7 @@ public class AzureContainerListService implements RootListService {
|
||||
for(BlobContainerItem container : session.getClient().listBlobContainers(new ListBlobContainersOptions()
|
||||
.setMaxResultsPerPage(HostPreferencesFactory.get(session.getHost()).getInteger("azure.listing.chunksize"))
|
||||
.setDetails(new BlobContainerListDetails().setRetrieveDeleted(false).setRetrieveMetadata(true)), null)) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setETag(container.getProperties().getETag());
|
||||
attributes.setModificationDate(container.getProperties().getLastModified().toInstant().toEpochMilli());
|
||||
containers.add(new Path(PathNormalizer.normalize(container.getName()), EnumSet.of(Path.Type.volume, Path.Type.directory), attributes));
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.b2;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.DefaultIOExceptionMappingService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DefaultPathContainerService;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -70,7 +71,7 @@ public class B2AttributesFinderFeature implements AttributesFinder, AttributesAd
|
||||
// Pending large file upload
|
||||
final Write.Append append = new B2LargeUploadService(session, fileid).append(file, new TransferStatus());
|
||||
if(append.append) {
|
||||
return new PathAttributes().setSize(append.offset);
|
||||
return new DefaultPathAttributes().setSize(append.offset);
|
||||
}
|
||||
return PathAttributes.EMPTY;
|
||||
}
|
||||
@@ -145,7 +146,7 @@ public class B2AttributesFinderFeature implements AttributesFinder, AttributesAd
|
||||
}
|
||||
|
||||
protected PathAttributes toAttributes(final B2FileInfoResponse response) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
if(response.getFileInfo().containsKey(X_BZ_INFO_LARGE_FILE_SHA1)) {
|
||||
attributes.setChecksum(Checksum.parse(response.getFileInfo().get(X_BZ_INFO_LARGE_FILE_SHA1)));
|
||||
}
|
||||
@@ -197,7 +198,7 @@ public class B2AttributesFinderFeature implements AttributesFinder, AttributesAd
|
||||
}
|
||||
|
||||
protected PathAttributes toAttributes(final B2FileResponse response) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(response.getContentLength());
|
||||
if(response.getFileInfo().containsKey(X_BZ_INFO_LARGE_FILE_SHA1)) {
|
||||
attributes.setChecksum(Checksum.parse(response.getFileInfo().get(X_BZ_INFO_LARGE_FILE_SHA1)));
|
||||
@@ -248,7 +249,7 @@ public class B2AttributesFinderFeature implements AttributesFinder, AttributesAd
|
||||
}
|
||||
|
||||
protected PathAttributes toAttributes(final B2BucketResponse response) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setVersionId(response.getBucketId());
|
||||
attributes.setRegion(response.getBucketType().name());
|
||||
switch(response.getBucketType()) {
|
||||
@@ -259,7 +260,7 @@ public class B2AttributesFinderFeature implements AttributesFinder, AttributesAd
|
||||
}
|
||||
|
||||
protected PathAttributes toAttributes(final B2FinishLargeFileResponse response) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(response.getContentLength());
|
||||
if(response.getFileInfo().containsKey(X_BZ_INFO_LARGE_FILE_SHA1)) {
|
||||
attributes.setChecksum(Checksum.parse(response.getFileInfo().get(X_BZ_INFO_LARGE_FILE_SHA1)));
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.b2;
|
||||
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultIOExceptionMappingService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.PathContainerService;
|
||||
@@ -129,7 +130,7 @@ public class B2LargeCopyFeature implements Copy {
|
||||
session.getClient().finishLargeFileUpload(response.getFileId(), checksums.toArray(new String[checksums.size()]));
|
||||
log.info("Finished large file upload {} with {} parts", target, completed.size());
|
||||
fileid.cache(target, response.getFileId());
|
||||
return new Path(target).withAttributes(new PathAttributes(source.attributes()).setVersionId(response.getFileId()));
|
||||
return new Path(target).withAttributes(new DefaultPathAttributes(source.attributes()).setVersionId(response.getFileId()));
|
||||
}
|
||||
catch(B2ApiException e) {
|
||||
throw new B2ExceptionMappingService(fileid).map("Cannot copy {0}", e, source);
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.b2;
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultIOExceptionMappingService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.HostKeyCallback;
|
||||
import ch.cyberduck.core.ListService;
|
||||
@@ -92,7 +93,7 @@ public class B2Session extends HttpSession<B2ApiClient> {
|
||||
if(!response.getBuckets().isEmpty()) {
|
||||
buckets.addAll(response.getBuckets().entrySet().stream().map(entry ->
|
||||
new Path(PathNormalizer.normalize(entry.getValue()), EnumSet.of(Path.Type.directory, Path.Type.volume),
|
||||
new PathAttributes().setVersionId(entry.getKey()))).collect(Collectors.toSet()));
|
||||
new DefaultPathAttributes().setVersionId(entry.getKey()))).collect(Collectors.toSet()));
|
||||
}
|
||||
retryHandler.setTokens(accountId, applicationKey, response.getAuthorizationToken());
|
||||
if(preferences.getBoolean("b2.upload.largeobject.auto")) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package ch.cyberduck.core.b2;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AsciiRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
@@ -216,7 +217,7 @@ public class B2ObjectListServiceTest extends AbstractB2Test {
|
||||
assertEquals(Long.valueOf(1L), list.find(path -> path.attributes().isDuplicate()).attributes().getRevision());
|
||||
}
|
||||
// Add hide marker
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(new PathAttributes(file.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(new DefaultPathAttributes(file.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
{
|
||||
final AttributedList<Path> list = new B2ObjectListService(session, fileid).list(bucket, new DisabledListProgressListener());
|
||||
assertEquals(3, list.size());
|
||||
@@ -337,14 +338,14 @@ public class B2ObjectListServiceTest extends AbstractB2Test {
|
||||
assertSame(folder1, list.find(new SimplePathPredicate(file1)).getParent());
|
||||
assertSame(folder1, list.find(new SimplePathPredicate(folder2)).getParent());
|
||||
// Nullify version to add delete marker
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(file2).withAttributes(new PathAttributes(file2.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(file2).withAttributes(new DefaultPathAttributes(file2.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertTrue(new B2ObjectListService(session, fileid, 1, VersioningConfiguration.empty()).list(folder2, new DisabledListProgressListener()).isEmpty());
|
||||
assertFalse(new B2ObjectListService(session, fileid).list(folder2, new DisabledListProgressListener()).isEmpty());
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(folder2), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertTrue(new B2ObjectListService(session, fileid).list(folder2, new DisabledListProgressListener()).contains(file2));
|
||||
assertThrows(NotfoundException.class, () -> new B2ObjectListService(session, fileid, 1, VersioningConfiguration.empty()).list(folder2, new DisabledListProgressListener()));
|
||||
// Nullify version to add delete marker
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(file1).withAttributes(new PathAttributes(file1.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(file1).withAttributes(new DefaultPathAttributes(file1.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertTrue(new B2ObjectListService(session, fileid, 1, VersioningConfiguration.empty()).list(folder1, new DisabledListProgressListener()).isEmpty());
|
||||
assertTrue(new B2ObjectListService(session, fileid).list(folder1, new DisabledListProgressListener()).contains(folder2));
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(folder1), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
@@ -374,7 +375,7 @@ public class B2ObjectListServiceTest extends AbstractB2Test {
|
||||
assertFalse(foundFolder1.attributes().isDuplicate());
|
||||
}
|
||||
// Nullify version to add delete marker
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(file1).withAttributes(new PathAttributes(file1.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(file1).withAttributes(new DefaultPathAttributes(file1.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertTrue(new B2ObjectListService(session, fileid, 1, VersioningConfiguration.empty()).list(bucket, new DisabledListProgressListener()).isEmpty());
|
||||
{
|
||||
final AttributedList<Path> list = new B2ObjectListService(session, fileid).list(bucket, new DisabledListProgressListener());
|
||||
@@ -411,7 +412,7 @@ public class B2ObjectListServiceTest extends AbstractB2Test {
|
||||
assertFalse(foundFolder2.attributes().isDuplicate());
|
||||
}
|
||||
// Nullify version to add delete marker
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(new PathAttributes(file.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(new DefaultPathAttributes(file.attributes()).setVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertTrue(new DefaultFindFeature(session).find(folder1, new DisabledListProgressListener()));
|
||||
assertTrue(new B2ObjectListService(session, fileid).list(folder1, new DisabledListProgressListener()).contains(folder2));
|
||||
assertTrue(new DefaultFindFeature(session).find(folder2, new DisabledListProgressListener()));
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.b2;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.DisabledPasswordCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -52,7 +53,7 @@ public class B2VersionIdProviderTest extends AbstractB2Test {
|
||||
catch(NotfoundException e) {
|
||||
// Expected
|
||||
}
|
||||
final PathAttributes duplicate = new PathAttributes();
|
||||
final PathAttributes duplicate = new DefaultPathAttributes();
|
||||
duplicate.setVersionId("d");
|
||||
duplicate.setDuplicate(true);
|
||||
fileid.cache(new Path(file).withAttributes(duplicate), "d");
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.b2;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
@@ -60,7 +61,7 @@ public class B2VersioningFeatureTest extends AbstractB2Test {
|
||||
new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out);
|
||||
}
|
||||
assertTrue(new B2FindFeature(session, fileid).find(ignored));
|
||||
final PathAttributes initialAttributes = new PathAttributes(test.attributes());
|
||||
final PathAttributes initialAttributes = new DefaultPathAttributes(test.attributes());
|
||||
final String initialVersion = test.attributes().getVersionId();
|
||||
final byte[] content = RandomUtils.nextBytes(32769);
|
||||
final TransferStatus status = new TransferStatus();
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.box;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -64,7 +65,7 @@ public class BoxAttributesFinderFeature implements AttributesFinder, AttributesA
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final File f) {
|
||||
final PathAttributes attrs = new PathAttributes();
|
||||
final PathAttributes attrs = new DefaultPathAttributes();
|
||||
if(null != f.getContentModifiedAt()) {
|
||||
attrs.setModificationDate(f.getContentModifiedAt().getMillis());
|
||||
}
|
||||
@@ -81,7 +82,7 @@ public class BoxAttributesFinderFeature implements AttributesFinder, AttributesA
|
||||
}
|
||||
|
||||
protected PathAttributes toAttributes(final Folder f) {
|
||||
final PathAttributes attrs = new PathAttributes();
|
||||
final PathAttributes attrs = new DefaultPathAttributes();
|
||||
if(null != f.getContentModifiedAt()) {
|
||||
attrs.setModificationDate(f.getContentModifiedAt().getMillis());
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.brick;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -64,7 +65,7 @@ public class BrickAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final FileEntity entity) {
|
||||
final PathAttributes attr = new PathAttributes();
|
||||
final PathAttributes attr = new DefaultPathAttributes();
|
||||
attr.setChecksum(Checksum.parse(entity.getMd5()));
|
||||
attr.setRegion(entity.getRegion());
|
||||
if(entity.getSize() != null) {
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.brick;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.brick.io.swagger.client.ApiException;
|
||||
@@ -62,7 +63,7 @@ public class BrickCopyFeature extends BrickFileMigrationFeature implements Copy
|
||||
if(entity.getFileMigrationId() != null) {
|
||||
this.poll(client, entity);
|
||||
}
|
||||
return new Path(target).withAttributes(new PathAttributes(file.attributes()).setVault(null));
|
||||
return new Path(target).withAttributes(new DefaultPathAttributes(file.attributes()).setVault(null));
|
||||
}
|
||||
catch(ApiException e) {
|
||||
throw new BrickExceptionMappingService().map("Cannot copy {0}", e, file);
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.brick;
|
||||
|
||||
import ch.cyberduck.core.CaseInsensitivePathPredicate;
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.brick.io.swagger.client.ApiException;
|
||||
@@ -60,7 +61,7 @@ public class BrickMoveFeature extends BrickFileMigrationFeature implements Move
|
||||
if(entity.getFileMigrationId() != null) {
|
||||
this.poll(client, entity);
|
||||
}
|
||||
return new Path(target).withAttributes(new PathAttributes(file.attributes()).setVault(null));
|
||||
return new Path(target).withAttributes(new DefaultPathAttributes(file.attributes()).setVault(null));
|
||||
}
|
||||
catch(ApiException e) {
|
||||
throw new BrickExceptionMappingService().map("Cannot rename {0}", e, file);
|
||||
|
||||
@@ -0,0 +1,752 @@
|
||||
package ch.cyberduck.core;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 David Kocher. All rights reserved.
|
||||
* http://cyberduck.ch/
|
||||
*
|
||||
* 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 2 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.
|
||||
*
|
||||
* Bug fixes, suggestions and comments should be sent to:
|
||||
* dkocher@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.features.Encryption;
|
||||
import ch.cyberduck.core.features.Quota;
|
||||
import ch.cyberduck.core.io.Checksum;
|
||||
import ch.cyberduck.core.serializer.Serializer;
|
||||
import ch.cyberduck.core.transfer.TransferStatus;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Attributes of a remote directory or file.
|
||||
*/
|
||||
public class DefaultPathAttributes implements PathAttributes, Attributes, Serializable {
|
||||
private static final Logger log = LogManager.getLogger(DefaultPathAttributes.class);
|
||||
|
||||
/**
|
||||
* The file length
|
||||
*/
|
||||
private long size = TransferStatus.UNKNOWN_LENGTH;
|
||||
|
||||
/**
|
||||
* Quota of folder
|
||||
*/
|
||||
private Quota.Space quota = Quota.unknown;
|
||||
|
||||
/**
|
||||
* The file modification date in milliseconds
|
||||
*/
|
||||
private long modified = -1;
|
||||
/**
|
||||
* Last accessed timestamp in milliseconds
|
||||
*/
|
||||
private long accessed = -1;
|
||||
/**
|
||||
* When this file was originally created in milliseconds
|
||||
*/
|
||||
private long created = -1;
|
||||
|
||||
private String owner;
|
||||
private String group;
|
||||
|
||||
private Permission permission = Permission.EMPTY;
|
||||
|
||||
private Acl acl = Acl.EMPTY;
|
||||
|
||||
/**
|
||||
* MD5 checksum
|
||||
*/
|
||||
private Checksum checksum = Checksum.NONE;
|
||||
|
||||
/**
|
||||
* ETag header in HTTP
|
||||
*/
|
||||
private String etag;
|
||||
|
||||
/**
|
||||
* Redundancy level if available
|
||||
*/
|
||||
private String storageClass;
|
||||
|
||||
/**
|
||||
* Server side encryption (SSE) algorithm and key or null
|
||||
*/
|
||||
private Encryption.Algorithm encryption = Encryption.Algorithm.NONE;
|
||||
|
||||
/**
|
||||
* Unique identifier for a given file. Must remain constant even after updating the file.
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* Unique identifier for a given version of a file
|
||||
*/
|
||||
private String versionId;
|
||||
|
||||
/**
|
||||
* Lock id
|
||||
*/
|
||||
private String lockId;
|
||||
|
||||
/**
|
||||
* Should be hidden in the browser by default
|
||||
*/
|
||||
private Boolean duplicate;
|
||||
|
||||
/**
|
||||
* Hidden flag set on server
|
||||
*/
|
||||
private Boolean hidden;
|
||||
|
||||
/**
|
||||
* Trashed
|
||||
*/
|
||||
private Boolean trashed;
|
||||
|
||||
/**
|
||||
* Revision number
|
||||
*/
|
||||
private Long revision;
|
||||
|
||||
/**
|
||||
* Geographical location
|
||||
*/
|
||||
private String region;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String displayname;
|
||||
|
||||
private DescriptiveUrl link = DescriptiveUrl.EMPTY;
|
||||
|
||||
/**
|
||||
* HTTP headers
|
||||
*/
|
||||
private Map<String, String> metadata = Collections.emptyMap();
|
||||
|
||||
/**
|
||||
* Cryptomator vault
|
||||
*/
|
||||
private Path vault;
|
||||
/**
|
||||
* Cryptomator decrypted path
|
||||
*/
|
||||
private Path decrypted;
|
||||
/**
|
||||
* Cryptomator encrypted path.
|
||||
*/
|
||||
private Path encrypted;
|
||||
/**
|
||||
* Unique identifier for cryptomator
|
||||
*/
|
||||
private String directoryId;
|
||||
|
||||
private Map<String, String> custom = Collections.emptyMap();
|
||||
|
||||
private Verdict verdict;
|
||||
|
||||
public DefaultPathAttributes() {
|
||||
}
|
||||
|
||||
public DefaultPathAttributes(final PathAttributes copy) {
|
||||
size = copy.getSize();
|
||||
quota = copy.getQuota();
|
||||
modified = copy.getModificationDate();
|
||||
accessed = copy.getAccessedDate();
|
||||
created = copy.getCreationDate();
|
||||
owner = copy.getOwner();
|
||||
group = copy.getGroup();
|
||||
permission = Permission.EMPTY == copy.getPermission() ? Permission.EMPTY : new Permission(copy.getPermission());
|
||||
acl = Acl.EMPTY == copy.getAcl() ? Acl.EMPTY : new Acl(copy.getAcl());
|
||||
checksum = Checksum.NONE == copy.getChecksum() ? Checksum.NONE : new Checksum(copy.getChecksum());
|
||||
etag = copy.getETag();
|
||||
storageClass = copy.getStorageClass();
|
||||
encryption = copy.getEncryption();
|
||||
fileId = copy.getFileId();
|
||||
versionId = copy.getVersionId();
|
||||
lockId = copy.getLockId();
|
||||
duplicate = copy.isDuplicate();
|
||||
hidden = copy.isHidden();
|
||||
trashed = copy.isTrashed();
|
||||
revision = copy.getRevision();
|
||||
region = copy.getRegion();
|
||||
displayname = copy.getDisplayname();
|
||||
link = DescriptiveUrl.EMPTY == copy.getLink() ? DescriptiveUrl.EMPTY : new DescriptiveUrl(copy.getLink());
|
||||
metadata = new HashMap<>(copy.getMetadata());
|
||||
custom = new HashMap<>(copy.getCustom());
|
||||
verdict = copy.getVerdict();
|
||||
vault = copy.getVault();
|
||||
decrypted = copy.getDecrypted();
|
||||
encrypted = copy.getEncrypted();
|
||||
directoryId = copy.getDirectoryId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T serialize(final Serializer<T> dict) {
|
||||
if(size != -1) {
|
||||
dict.setStringForKey(String.valueOf(size), "Size");
|
||||
}
|
||||
if(quota != Quota.unknown) {
|
||||
// Set remaining quota
|
||||
dict.setStringForKey(String.valueOf(quota.available), "Quota");
|
||||
}
|
||||
if(modified != -1) {
|
||||
dict.setStringForKey(String.valueOf(modified), "Modified");
|
||||
}
|
||||
if(created != -1) {
|
||||
dict.setStringForKey(String.valueOf(created), "Created");
|
||||
}
|
||||
if(revision != null) {
|
||||
dict.setStringForKey(String.valueOf(revision), "Revision");
|
||||
}
|
||||
if(etag != null) {
|
||||
dict.setStringForKey(etag, "ETag");
|
||||
}
|
||||
if(permission != Permission.EMPTY) {
|
||||
dict.setObjectForKey(permission, "Permission");
|
||||
}
|
||||
if(owner != null) {
|
||||
dict.setStringForKey(owner, "Owner");
|
||||
}
|
||||
if(group != null) {
|
||||
dict.setStringForKey(group, "Group");
|
||||
}
|
||||
if(acl != Acl.EMPTY) {
|
||||
dict.setObjectForKey(acl, "Acl");
|
||||
}
|
||||
if(link != DescriptiveUrl.EMPTY) {
|
||||
final Map<String, String> wrapper = new HashMap<>();
|
||||
wrapper.put("Url", link.getUrl());
|
||||
wrapper.put("Type", link.getType().name());
|
||||
dict.setMapForKey(wrapper, "Link");
|
||||
}
|
||||
if(checksum != Checksum.NONE) {
|
||||
final Map<String, String> wrapper = new HashMap<>();
|
||||
wrapper.put("Algorithm", checksum.algorithm.name());
|
||||
wrapper.put("Hash", checksum.hash);
|
||||
if(null != checksum.base64) {
|
||||
wrapper.put("Base64", checksum.base64);
|
||||
}
|
||||
dict.setMapForKey(wrapper, "Checksum");
|
||||
}
|
||||
if(StringUtils.isNotBlank(versionId)) {
|
||||
dict.setStringForKey(versionId, "Version");
|
||||
}
|
||||
if(StringUtils.isNotBlank(fileId)) {
|
||||
dict.setStringForKey(fileId, "File Id");
|
||||
}
|
||||
if(StringUtils.isNotBlank(displayname)) {
|
||||
dict.setStringForKey(displayname, "Display Name");
|
||||
}
|
||||
if(StringUtils.isNotBlank(lockId)) {
|
||||
dict.setStringForKey(lockId, "Lock Id");
|
||||
}
|
||||
if(duplicate != null) {
|
||||
dict.setStringForKey(String.valueOf(duplicate), "Duplicate");
|
||||
}
|
||||
if(hidden != null) {
|
||||
dict.setStringForKey(String.valueOf(hidden), "Hidden");
|
||||
}
|
||||
if(trashed != null) {
|
||||
dict.setStringForKey(String.valueOf(trashed), "Trashed");
|
||||
}
|
||||
if(StringUtils.isNotBlank(region)) {
|
||||
dict.setStringForKey(region, "Region");
|
||||
}
|
||||
if(StringUtils.isNotBlank(storageClass)) {
|
||||
dict.setStringForKey(storageClass, "Storage Class");
|
||||
}
|
||||
if(vault != null) {
|
||||
if(vault.attributes() == this) {
|
||||
log.debug("Skip serializing vault attribute {} to avoid recursion", vault);
|
||||
}
|
||||
else {
|
||||
dict.setObjectForKey(vault, "Vault");
|
||||
}
|
||||
}
|
||||
if(!custom.isEmpty()) {
|
||||
dict.setMapForKey(custom, "Custom");
|
||||
}
|
||||
if(verdict != null) {
|
||||
dict.setStringForKey(verdict.name(), "Verdict");
|
||||
}
|
||||
return dict.getSerialized();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return length the size of file in bytes.
|
||||
*/
|
||||
@Override
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param size the size of file in bytes.
|
||||
*/
|
||||
@Override
|
||||
public DefaultPathAttributes setSize(final long size) {
|
||||
this.size = size;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Quota.Space getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setQuota(final Quota.Space quota) {
|
||||
this.quota = quota;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getModificationDate() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setModificationDate(final long millis) {
|
||||
this.modified = millis;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCreationDate() {
|
||||
return created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setCreationDate(final long millis) {
|
||||
this.created = millis;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccessedDate() {
|
||||
return accessed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setAccessedDate(final long millis) {
|
||||
this.accessed = millis;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UNIX permissions
|
||||
*/
|
||||
@Override
|
||||
public Permission getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p UNIX permissions
|
||||
*/
|
||||
@Override
|
||||
public DefaultPathAttributes setPermission(final Permission p) {
|
||||
this.permission = p;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Acl getAcl() {
|
||||
return acl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setAcl(final Acl acl) {
|
||||
this.acl = acl;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setOwner(final String o) {
|
||||
this.owner = o;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setGroup(final String g) {
|
||||
this.group = g;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Checksum getChecksum() {
|
||||
return checksum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setChecksum(final Checksum checksum) {
|
||||
this.checksum = checksum;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getETag() {
|
||||
return etag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setETag(final String etag) {
|
||||
this.etag = etag;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Storage redundancy identifier.
|
||||
*/
|
||||
@Override
|
||||
public String getStorageClass() {
|
||||
return storageClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param storageClass Storage redundancy identifier.
|
||||
*/
|
||||
@Override
|
||||
public DefaultPathAttributes setStorageClass(final String storageClass) {
|
||||
this.storageClass = storageClass;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Encryption.Algorithm getEncryption() {
|
||||
return encryption;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setEncryption(final Encryption.Algorithm encryption) {
|
||||
this.encryption = encryption;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A version identifying a particular revision of a file with the same path.
|
||||
*
|
||||
* @return Version Identifier or null if not versioned.
|
||||
*/
|
||||
@Override
|
||||
public String getVersionId() {
|
||||
return versionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a unique version identifier for the revision of a file.
|
||||
*
|
||||
* @param versionId Revision
|
||||
*/
|
||||
@Override
|
||||
public DefaultPathAttributes setVersionId(final String versionId) {
|
||||
this.versionId = versionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for a file with the same path. Remains constant over its lifetime.
|
||||
*
|
||||
* @return Identifier or null if there is no such concept
|
||||
*/
|
||||
@Override
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setFileId(final String fileId) {
|
||||
this.fileId = fileId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLockId() {
|
||||
return lockId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setLockId(final String lockId) {
|
||||
this.lockId = lockId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDirectoryId() {
|
||||
return directoryId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setDirectoryId(final String directoryId) {
|
||||
this.directoryId = directoryId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getRevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setRevision(final Long revision) {
|
||||
this.revision = revision;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getDecrypted() {
|
||||
return decrypted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setDecrypted(final Path decrypted) {
|
||||
this.decrypted = decrypted;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getEncrypted() {
|
||||
return encrypted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setEncrypted(final Path encrypted) {
|
||||
this.encrypted = encrypted;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setVault(final Path vault) {
|
||||
this.vault = vault;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getVault() {
|
||||
return vault;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDuplicate() {
|
||||
return duplicate != null && duplicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute to mark a file as hidden by default in addition to a filename convention.
|
||||
*
|
||||
* @param duplicate Flag
|
||||
*/
|
||||
@Override
|
||||
public DefaultPathAttributes setDuplicate(final boolean duplicate) {
|
||||
this.duplicate = duplicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isHidden() {
|
||||
return hidden != null && hidden;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setHidden(final boolean hidden) {
|
||||
this.hidden = hidden;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isTrashed() {
|
||||
return trashed != null && trashed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setTrashed(final boolean trashed) {
|
||||
this.trashed = trashed;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setMetadata(final Map<String, String> metadata) {
|
||||
this.metadata = metadata;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setRegion(final String region) {
|
||||
this.region = region;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayname() {
|
||||
return displayname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setDisplayname(final String displayname) {
|
||||
this.displayname = displayname;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptiveUrl getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setLink(final DescriptiveUrl link) {
|
||||
this.link = link;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getCustom() {
|
||||
return custom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setCustom(final Map<String, String> custom) {
|
||||
this.custom = custom;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setCustom(final String key, final String value) {
|
||||
custom = new HashMap<>(custom);
|
||||
custom.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Verdict getVerdict() {
|
||||
return verdict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultPathAttributes setVerdict(final Verdict verdict) {
|
||||
this.verdict = verdict;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if(this == o) {
|
||||
return true;
|
||||
}
|
||||
if(!(o instanceof DefaultPathAttributes)) {
|
||||
return false;
|
||||
}
|
||||
final DefaultPathAttributes that = (DefaultPathAttributes) o;
|
||||
if(modified != that.modified) {
|
||||
return false;
|
||||
}
|
||||
if(size != that.size) {
|
||||
return false;
|
||||
}
|
||||
if(!Objects.equals(checksum, that.checksum)) {
|
||||
return false;
|
||||
}
|
||||
if(!Objects.equals(permission, that.permission)) {
|
||||
return false;
|
||||
}
|
||||
if(!Objects.equals(acl, that.acl)) {
|
||||
return false;
|
||||
}
|
||||
if(!Objects.equals(versionId, that.versionId)) {
|
||||
return false;
|
||||
}
|
||||
if(!Objects.equals(fileId, that.fileId)) {
|
||||
return false;
|
||||
}
|
||||
if(!Objects.equals(revision, that.revision)) {
|
||||
return false;
|
||||
}
|
||||
if(!Objects.equals(vault, that.vault)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (int) (size ^ (size >>> 32));
|
||||
result = 31 * result + (int) (modified ^ (modified >>> 32));
|
||||
result = 31 * result + (permission != null ? permission.hashCode() : 0);
|
||||
result = 31 * result + (acl != null ? acl.hashCode() : 0);
|
||||
result = 31 * result + (checksum != null ? checksum.hashCode() : 0);
|
||||
result = 31 * result + (versionId != null ? versionId.hashCode() : 0);
|
||||
result = 31 * result + (fileId != null ? fileId.hashCode() : 0);
|
||||
result = 31 * result + (revision != null ? revision.hashCode() : 0);
|
||||
result = 31 * result + (verdict != null ? verdict.hashCode() : 0);
|
||||
result = 31 * result + (vault != null ? vault.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("PathAttributes{");
|
||||
sb.append("accessed=").append(accessed);
|
||||
sb.append(", size=").append(size);
|
||||
sb.append(", modified=").append(modified);
|
||||
sb.append(", created=").append(created);
|
||||
sb.append(", owner='").append(owner).append('\'');
|
||||
sb.append(", group='").append(group).append('\'');
|
||||
sb.append(", permission=").append(permission);
|
||||
sb.append(", acl=").append(acl);
|
||||
sb.append(", checksum='").append(checksum).append('\'');
|
||||
sb.append(", etag='").append(etag).append('\'');
|
||||
sb.append(", storageClass='").append(storageClass).append('\'');
|
||||
sb.append(", encryption='").append(encryption).append('\'');
|
||||
sb.append(", versionId='").append(versionId).append('\'');
|
||||
sb.append(", fileId='").append(fileId).append('\'');
|
||||
sb.append(", lockId='").append(lockId).append('\'');
|
||||
sb.append(", duplicate=").append(duplicate);
|
||||
sb.append(", hidden=").append(hidden);
|
||||
sb.append(", trashed=").append(trashed);
|
||||
sb.append(", revision=").append(revision);
|
||||
sb.append(", region='").append(region).append('\'');
|
||||
sb.append(", metadata=").append(metadata).append('\'');
|
||||
sb.append(", custom=").append(custom).append('\'');
|
||||
sb.append(", verdict=").append(verdict).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class Path extends AbstractPath implements Referenceable, Serializable {
|
||||
this.path = copy.path;
|
||||
this.symlink = null == copy.symlink ? null : new Path(copy.symlink);
|
||||
this.type = EnumSet.copyOf(copy.type);
|
||||
this.attributes = new PathAttributes(copy.attributes);
|
||||
this.attributes = new DefaultPathAttributes(copy.attributes);
|
||||
this.alias = copy.alias;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Path extends AbstractPath implements Referenceable, Serializable {
|
||||
*/
|
||||
public Path(final Path parent, final String name, final EnumSet<Type> type) {
|
||||
this.type = type;
|
||||
this.attributes = new PathAttributes();
|
||||
this.attributes = new DefaultPathAttributes();
|
||||
this.attributes.setRegion(parent.attributes.getRegion());
|
||||
this._setPath(parent, name);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class Path extends AbstractPath implements Referenceable, Serializable {
|
||||
*/
|
||||
public Path(final String absolute, final EnumSet<Type> type) {
|
||||
this.type = type;
|
||||
this.attributes = new PathAttributes();
|
||||
this.attributes = new DefaultPathAttributes();
|
||||
this.setPath(absolute);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,342 @@
|
||||
package ch.cyberduck.core;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002-2025 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.features.Encryption;
|
||||
import ch.cyberduck.core.features.Quota;
|
||||
import ch.cyberduck.core.io.Checksum;
|
||||
import ch.cyberduck.core.serializer.Serializer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ProxyPathAttributes implements PathAttributes {
|
||||
|
||||
private final PathAttributes proxy;
|
||||
|
||||
public ProxyPathAttributes(final PathAttributes proxy) {
|
||||
this.proxy = proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setSize(final long size) {
|
||||
return proxy.setSize(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Quota.Space getQuota() {
|
||||
return proxy.getQuota();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setQuota(final Quota.Space quota) {
|
||||
return proxy.setQuota(quota);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setModificationDate(final long millis) {
|
||||
return proxy.setModificationDate(millis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setCreationDate(final long millis) {
|
||||
return proxy.setCreationDate(millis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setAccessedDate(final long millis) {
|
||||
return proxy.setAccessedDate(millis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setPermission(final Permission p) {
|
||||
return proxy.setPermission(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Acl getAcl() {
|
||||
return proxy.getAcl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setAcl(final Acl acl) {
|
||||
return proxy.setAcl(acl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setOwner(final String o) {
|
||||
return proxy.setOwner(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setGroup(final String g) {
|
||||
return proxy.setGroup(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Checksum getChecksum() {
|
||||
return proxy.getChecksum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setChecksum(final Checksum checksum) {
|
||||
return proxy.setChecksum(checksum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getETag() {
|
||||
return proxy.getETag();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setETag(final String etag) {
|
||||
return proxy.setETag(etag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStorageClass() {
|
||||
return proxy.getStorageClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setStorageClass(final String storageClass) {
|
||||
return proxy.setStorageClass(storageClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Encryption.Algorithm getEncryption() {
|
||||
return proxy.getEncryption();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setEncryption(final Encryption.Algorithm encryption) {
|
||||
return proxy.setEncryption(encryption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersionId() {
|
||||
return proxy.getVersionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setVersionId(final String versionId) {
|
||||
return proxy.setVersionId(versionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileId() {
|
||||
return proxy.getFileId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setFileId(final String fileId) {
|
||||
return proxy.setFileId(fileId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLockId() {
|
||||
return proxy.getLockId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setLockId(final String lockId) {
|
||||
return proxy.setLockId(lockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDirectoryId() {
|
||||
return proxy.getDirectoryId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setDirectoryId(final String directoryId) {
|
||||
return proxy.setDirectoryId(directoryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getRevision() {
|
||||
return proxy.getRevision();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setRevision(final Long revision) {
|
||||
return proxy.setRevision(revision);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getDecrypted() {
|
||||
return proxy.getDecrypted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setDecrypted(final Path decrypted) {
|
||||
return proxy.setDecrypted(decrypted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getEncrypted() {
|
||||
return proxy.getEncrypted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setEncrypted(final Path encrypted) {
|
||||
return proxy.setEncrypted(encrypted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setVault(final Path vault) {
|
||||
return proxy.setVault(vault);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getVault() {
|
||||
return proxy.getVault();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDuplicate() {
|
||||
return proxy.isDuplicate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setDuplicate(final boolean duplicate) {
|
||||
return proxy.setDuplicate(duplicate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isHidden() {
|
||||
return proxy.isHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setHidden(final boolean hidden) {
|
||||
return proxy.setHidden(hidden);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isTrashed() {
|
||||
return proxy.isTrashed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setTrashed(final boolean trashed) {
|
||||
return proxy.setTrashed(trashed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getMetadata() {
|
||||
return proxy.getMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setMetadata(final Map<String, String> metadata) {
|
||||
return proxy.setMetadata(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRegion() {
|
||||
return proxy.getRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setRegion(final String region) {
|
||||
return proxy.setRegion(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayname() {
|
||||
return proxy.getDisplayname();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setDisplayname(final String displayname) {
|
||||
return proxy.setDisplayname(displayname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DescriptiveUrl getLink() {
|
||||
return proxy.getLink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setLink(final DescriptiveUrl link) {
|
||||
return proxy.setLink(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getCustom() {
|
||||
return proxy.getCustom();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setCustom(final Map<String, String> custom) {
|
||||
return proxy.setCustom(custom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setCustom(final String key, final String value) {
|
||||
return proxy.setCustom(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Verdict getVerdict() {
|
||||
return proxy.getVerdict();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes setVerdict(final Verdict verdict) {
|
||||
return proxy.setVerdict(verdict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return proxy.getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getModificationDate() {
|
||||
return proxy.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCreationDate() {
|
||||
return proxy.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccessedDate() {
|
||||
return proxy.getAccessedDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Permission getPermission() {
|
||||
return proxy.getPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
return proxy.getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return proxy.getGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T serialize(final Serializer<T> dict) {
|
||||
return proxy.serialize(dict);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.profiles;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
@@ -97,7 +98,7 @@ public class RemoteProfilesFinder implements ProfilesFinder {
|
||||
final Read read = session.getFeature(Read.class);
|
||||
log.info("Download profile {}", file);
|
||||
// Read latest version
|
||||
try(InputStream in = read.read(file.withAttributes(new PathAttributes(file.attributes())
|
||||
try(InputStream in = read.read(file.withAttributes(new DefaultPathAttributes(file.attributes())
|
||||
// Read latest version
|
||||
.setVersionId(null)), new TransferStatus().setLength(TransferStatus.UNKNOWN_LENGTH), new DisabledConnectionCallback()); OutputStream out = local.getOutputStream(false)) {
|
||||
IOUtils.copy(in, out);
|
||||
|
||||
@@ -18,6 +18,7 @@ package ch.cyberduck.core.serializer;
|
||||
* feedback@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DescriptiveUrl;
|
||||
import ch.cyberduck.core.DeserializerFactory;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -42,7 +43,7 @@ public class PathAttributesDictionary<T> {
|
||||
|
||||
public PathAttributes deserialize(final T serialized) {
|
||||
final Deserializer<T> dict = factory.create(serialized);
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
final String sizeObj = dict.stringForKey("Size");
|
||||
if(sizeObj != null) {
|
||||
attributes.setSize(Long.parseLong(sizeObj));
|
||||
|
||||
@@ -18,6 +18,7 @@ package ch.cyberduck.core.synchronization;
|
||||
* dkocher@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Local;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -67,7 +68,7 @@ public class DefaultComparePathFilter implements ComparePathFilter {
|
||||
return Comparison.equal;
|
||||
}
|
||||
final PathAttributes remote = attribute.find(file);
|
||||
final PathAttributes current = new PathAttributes()
|
||||
final PathAttributes current = new DefaultPathAttributes()
|
||||
.setModificationDate(local.attributes().getModificationDate())
|
||||
.setSize(local.attributes().getSize());
|
||||
// We must always compare the size because the download filter will have already created a temporary 0 byte file
|
||||
|
||||
@@ -76,34 +76,34 @@ public class DefaultPathPredicateTest {
|
||||
|
||||
@Test
|
||||
public void testPredicateVersionIdFile() {
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.file), new PathAttributes().setVersionId("1"));
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.file), new DefaultPathAttributes().setVersionId("1"));
|
||||
assertTrue(new DefaultPathPredicate(t).test(t));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new PathAttributes().setVersionId("1"))));
|
||||
assertFalse(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new PathAttributes().setVersionId("2"))));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new DefaultPathAttributes().setVersionId("1"))));
|
||||
assertFalse(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new DefaultPathAttributes().setVersionId("2"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPredicateFileIdFile() {
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.file), new PathAttributes().setFileId("1"));
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.file), new DefaultPathAttributes().setFileId("1"));
|
||||
assertTrue(new DefaultPathPredicate(t).test(t));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new PathAttributes().setFileId("1"))));
|
||||
assertFalse(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new PathAttributes().setFileId("2"))));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new DefaultPathAttributes().setFileId("1"))));
|
||||
assertFalse(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.file), new DefaultPathAttributes().setFileId("2"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPredicateVersionIdDirectory() {
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.directory), new PathAttributes().setVersionId("1"));
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.directory), new DefaultPathAttributes().setVersionId("1"));
|
||||
assertTrue(new DefaultPathPredicate(t).test(t));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new PathAttributes().setVersionId("1"))));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new PathAttributes().setVersionId("2"))));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new DefaultPathAttributes().setVersionId("1"))));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new DefaultPathAttributes().setVersionId("2"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPredicateFileIdDirectory() {
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.directory), new PathAttributes().setFileId("1"));
|
||||
final Path t = new Path("/f", EnumSet.of(Path.Type.directory), new DefaultPathAttributes().setFileId("1"));
|
||||
assertTrue(new DefaultPathPredicate(t).test(t));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new PathAttributes().setFileId("1"))));
|
||||
assertFalse(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new PathAttributes().setFileId("2"))));
|
||||
assertTrue(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new DefaultPathAttributes().setFileId("1"))));
|
||||
assertFalse(new DefaultPathPredicate(t).test(new Path("/f", EnumSet.of(Path.Type.directory), new DefaultPathAttributes().setFileId("2"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -17,7 +17,7 @@ public class PathAttributesTest {
|
||||
|
||||
@Test
|
||||
public void testCopy() {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(1L);
|
||||
attributes.setQuota(new Quota.Space(1L, 10L));
|
||||
attributes.setModificationDate(System.currentTimeMillis());
|
||||
@@ -31,7 +31,7 @@ public class PathAttributesTest {
|
||||
attributes.setVerdict(PathAttributes.Verdict.pending);
|
||||
attributes.setTrashed(true);
|
||||
attributes.setHidden(true);
|
||||
final PathAttributes clone = new PathAttributes(attributes);
|
||||
final PathAttributes clone = new DefaultPathAttributes(attributes);
|
||||
assertEquals(clone.getPermission(), attributes.getPermission());
|
||||
assertEquals(clone.getModificationDate(), attributes.getModificationDate());
|
||||
assertEquals(clone, attributes);
|
||||
@@ -49,7 +49,7 @@ public class PathAttributesTest {
|
||||
|
||||
@Test
|
||||
public void testPermissions() {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
assertNull(attributes.getOwner());
|
||||
assertNull(attributes.getGroup());
|
||||
assertNotNull(attributes.getPermission());
|
||||
@@ -59,17 +59,17 @@ public class PathAttributesTest {
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
assertEquals(new PathAttributes(), new PathAttributes());
|
||||
final PathAttributes r1 = new PathAttributes();
|
||||
assertEquals(new DefaultPathAttributes(), new DefaultPathAttributes());
|
||||
final PathAttributes r1 = new DefaultPathAttributes();
|
||||
r1.setVersionId("r1");
|
||||
final PathAttributes r2 = new PathAttributes();
|
||||
final PathAttributes r2 = new DefaultPathAttributes();
|
||||
r2.setVersionId("r2");
|
||||
assertNotEquals(r1, r2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerialize() {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(100);
|
||||
attributes.setModificationDate(System.currentTimeMillis());
|
||||
attributes.setPermission(new Permission("644"));
|
||||
|
||||
@@ -69,7 +69,7 @@ public class PathCacheTest {
|
||||
@Test
|
||||
public void testDirectoryWithFileIdDefaultPredicate() {
|
||||
final PathCache cache = new PathCache(1);
|
||||
final Path f = new Path("/", EnumSet.of(Path.Type.directory)).withAttributes(new PathAttributes().setFileId("1"));
|
||||
final Path f = new Path("/", EnumSet.of(Path.Type.directory)).withAttributes(new DefaultPathAttributes().setFileId("1"));
|
||||
assertFalse(cache.containsKey(f));
|
||||
cache.put(f, new AttributedList<>());
|
||||
assertTrue(cache.containsKey(f));
|
||||
@@ -86,7 +86,7 @@ public class PathCacheTest {
|
||||
return new SimplePathPredicate(file);
|
||||
}
|
||||
};
|
||||
final Path f = new Path("/", EnumSet.of(Path.Type.directory)).withAttributes(new PathAttributes().setFileId("1"));
|
||||
final Path f = new Path("/", EnumSet.of(Path.Type.directory)).withAttributes(new DefaultPathAttributes().setFileId("1"));
|
||||
assertFalse(cache.containsKey(f));
|
||||
cache.put(f, new AttributedList<>());
|
||||
assertTrue(cache.containsKey(f));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ch.cyberduck.core;
|
||||
|
||||
public class TestPermissionAttributes extends PathAttributes {
|
||||
public class TestPermissionAttributes extends DefaultPathAttributes {
|
||||
public TestPermissionAttributes(Permission.Action action) {
|
||||
this(action, action);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.serializer;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DescriptiveUrl;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.Permission;
|
||||
@@ -29,7 +30,7 @@ public class PathAttributesDictionaryTest {
|
||||
|
||||
@Test
|
||||
public void testSerialize() {
|
||||
PathAttributes attributes = new PathAttributes();
|
||||
PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setOwner("u");
|
||||
attributes.setGroup("g");
|
||||
attributes.setTrashed(true);
|
||||
@@ -48,7 +49,7 @@ public class PathAttributesDictionaryTest {
|
||||
|
||||
@Test
|
||||
public void testGetAsDictionary() {
|
||||
PathAttributes attributes = new PathAttributes();
|
||||
PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(3L);
|
||||
attributes.setChecksum(Checksum.parse("da39a3ee5e6b4b0d3255bfef95601890afd80709"));
|
||||
attributes.setModificationDate(5343L);
|
||||
@@ -62,7 +63,7 @@ public class PathAttributesDictionaryTest {
|
||||
|
||||
@Test
|
||||
public void testSerializeHashCode() {
|
||||
PathAttributes attributes = new PathAttributes();
|
||||
PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setPermission(new Permission(644));
|
||||
attributes.setDuplicate(true);
|
||||
attributes.setVersionId("v-1");
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.shared;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.Protocol;
|
||||
@@ -37,32 +38,32 @@ public class ListFilteringFeatureTest {
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file))).test(
|
||||
new Path(Home.root(), "F", EnumSet.of(Path.Type.file))
|
||||
));
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setVersionId("v1"))
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setVersionId("v1"))
|
||||
));
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setVersionId("v2"))
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setVersionId("v2"))
|
||||
));
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new PathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new PathAttributes().setVersionId("v2"))
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new DefaultPathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new DefaultPathAttributes().setVersionId("v2"))
|
||||
));
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setFileId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setFileId("v1"))
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setFileId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setFileId("v1"))
|
||||
));
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setFileId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setFileId("v2"))
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setFileId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setFileId("v2"))
|
||||
));
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new PathAttributes().setFileId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new PathAttributes().setFileId("v2"))
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new DefaultPathAttributes().setFileId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.directory)).withAttributes(new DefaultPathAttributes().setFileId("v2"))
|
||||
));
|
||||
assertTrue(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setVersionId("v1"))
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setVersionId("v1"))
|
||||
));
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes())
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setVersionId("v1"))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes())
|
||||
));
|
||||
assertFalse(new ListFilteringFeature.ListFilteringPredicate(Protocol.Case.insensitive, new Path(Home.root(), "f", EnumSet.of(Path.Type.file))).test(
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes() {
|
||||
new Path(Home.root(), "f", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes() {
|
||||
@Override
|
||||
public boolean isDuplicate() {
|
||||
return true;
|
||||
|
||||
+9
-8
@@ -15,6 +15,7 @@ package ch.cyberduck.core.synchronization;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
|
||||
@@ -30,31 +31,31 @@ public class ChainedComparisonServiceTest {
|
||||
@Test
|
||||
public void testCompare() {
|
||||
assertEquals(Comparison.equal, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
|
||||
Path.Type.file, new PathAttributes().setModificationDate(1000L), new PathAttributes().setModificationDate(1000L)
|
||||
Path.Type.file, new DefaultPathAttributes().setModificationDate(1000L), new DefaultPathAttributes().setModificationDate(1000L)
|
||||
));
|
||||
assertEquals(Comparison.equal, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
|
||||
Path.Type.file, new PathAttributes().setModificationDate(1000L).setSize(1000L), new PathAttributes().setModificationDate(1000L).setSize(1000L)
|
||||
Path.Type.file, new DefaultPathAttributes().setModificationDate(1000L).setSize(1000L), new DefaultPathAttributes().setModificationDate(1000L).setSize(1000L)
|
||||
));
|
||||
assertEquals(Comparison.remote, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
|
||||
Path.Type.file, new PathAttributes().setModificationDate(1000L), new PathAttributes().setModificationDate(2000L)
|
||||
Path.Type.file, new DefaultPathAttributes().setModificationDate(1000L), new DefaultPathAttributes().setModificationDate(2000L)
|
||||
));
|
||||
assertEquals(Comparison.remote, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
|
||||
Path.Type.file, new PathAttributes().setModificationDate(1000L).setSize(1000L), new PathAttributes().setModificationDate(2000L).setSize(1000L)
|
||||
Path.Type.file, new DefaultPathAttributes().setModificationDate(1000L).setSize(1000L), new DefaultPathAttributes().setModificationDate(2000L).setSize(1000L)
|
||||
));
|
||||
assertEquals(Comparison.unknown, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
|
||||
Path.Type.file, new PathAttributes(), new PathAttributes()
|
||||
Path.Type.file, new DefaultPathAttributes(), new DefaultPathAttributes()
|
||||
));
|
||||
assertEquals(Comparison.equal, new ChainedComparisonService(new TimestampComparisonService(), new SizeComparisonService()).compare(
|
||||
Path.Type.file, new PathAttributes().setModificationDate(1000L).setSize(1000L), new PathAttributes().setModificationDate(1000L).setSize(2000L)
|
||||
Path.Type.file, new DefaultPathAttributes().setModificationDate(1000L).setSize(1000L), new DefaultPathAttributes().setModificationDate(1000L).setSize(2000L)
|
||||
));
|
||||
assertEquals(Comparison.notequal, new ChainedComparisonService(EnumSet.of(Comparison.unknown, Comparison.equal), new TimestampComparisonService(), new SizeComparisonService()).compare(
|
||||
Path.Type.file, new PathAttributes().setModificationDate(1000L).setSize(1000L), new PathAttributes().setModificationDate(1000L).setSize(2000L)
|
||||
Path.Type.file, new DefaultPathAttributes().setModificationDate(1000L).setSize(1000L), new DefaultPathAttributes().setModificationDate(1000L).setSize(2000L)
|
||||
));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
final PathAttributes attr = new PathAttributes().setModificationDate(1000L).setSize(2L);
|
||||
final PathAttributes attr = new DefaultPathAttributes().setModificationDate(1000L).setSize(2L);
|
||||
assertEquals(0, new ChainedComparisonService(new TimestampComparisonService()).hashCode(Path.Type.file, PathAttributes.EMPTY));
|
||||
assertNotEquals(0, new ChainedComparisonService(new TimestampComparisonService()).hashCode(Path.Type.file, attr));
|
||||
assertEquals(new ChainedComparisonService(new TimestampComparisonService()).hashCode(Path.Type.file, attr),
|
||||
|
||||
+7
-6
@@ -1,5 +1,6 @@
|
||||
package ch.cyberduck.core.synchronization;
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.io.Checksum;
|
||||
@@ -14,26 +15,26 @@ public class ChecksumComparisonServiceTest {
|
||||
@Test
|
||||
public void testCompare() {
|
||||
ComparisonService s = new ChecksumComparisonService();
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new PathAttributes() {
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new DefaultPathAttributes() {
|
||||
@Override
|
||||
public Checksum getChecksum() {
|
||||
return new Checksum(HashAlgorithm.md5, "a");
|
||||
}
|
||||
}, new PathAttributes().setChecksum(new Checksum(HashAlgorithm.md5, "a"))
|
||||
}, new DefaultPathAttributes().setChecksum(new Checksum(HashAlgorithm.md5, "a"))
|
||||
));
|
||||
|
||||
assertEquals(Comparison.notequal, s.compare(Path.Type.file, new PathAttributes() {
|
||||
assertEquals(Comparison.notequal, s.compare(Path.Type.file, new DefaultPathAttributes() {
|
||||
@Override
|
||||
public Checksum getChecksum() {
|
||||
return new Checksum(HashAlgorithm.md5, "b");
|
||||
}
|
||||
}, new PathAttributes().setChecksum(new Checksum(HashAlgorithm.md5, "a"))));
|
||||
}, new DefaultPathAttributes().setChecksum(new Checksum(HashAlgorithm.md5, "a"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectory() {
|
||||
ComparisonService s = new ChecksumComparisonService();
|
||||
assertEquals(Comparison.unknown, s.compare(Path.Type.directory, new PathAttributes(),
|
||||
new PathAttributes()));
|
||||
assertEquals(Comparison.unknown, s.compare(Path.Type.directory, new DefaultPathAttributes(),
|
||||
new DefaultPathAttributes()));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package ch.cyberduck.core.synchronization;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
@@ -36,7 +37,7 @@ public class DefaultComparePathFilterTest {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
attr.set(true);
|
||||
return new PathAttributes() {
|
||||
return new DefaultPathAttributes() {
|
||||
@Override
|
||||
public Checksum getChecksum() {
|
||||
return new Checksum(HashAlgorithm.md5, "a");
|
||||
@@ -163,7 +164,7 @@ public class DefaultComparePathFilterTest {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
attr.set(true);
|
||||
return new PathAttributes() {
|
||||
return new DefaultPathAttributes() {
|
||||
@Override
|
||||
public Checksum getChecksum() {
|
||||
return new Checksum(HashAlgorithm.md5, "b");
|
||||
|
||||
+25
-24
@@ -15,6 +15,7 @@ package ch.cyberduck.core.synchronization;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.TestProtocol;
|
||||
@@ -28,14 +29,14 @@ public class DefaultComparisonServiceTest {
|
||||
@Test
|
||||
public void testCompareFile() {
|
||||
final DefaultComparisonService c = new DefaultComparisonService(new TestProtocol());
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.file, new PathAttributes().setETag("1"), new PathAttributes().setETag("1")));
|
||||
assertEquals(1519, c.hashCode(Path.Type.file, new PathAttributes().setETag("1")));
|
||||
assertEquals(Comparison.unknown, c.compare(Path.Type.file, new PathAttributes().setETag("1"), new PathAttributes().setETag("2")));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.file, new PathAttributes().setETag("1").setSize(1000L), new PathAttributes().setETag("2").setSize(1000L)));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.file, new PathAttributes().setETag("1").setSize(1000L).setModificationDate(1680879106939L), new PathAttributes().setETag("2").setSize(1000L).setModificationDate(1680879106939L)));
|
||||
assertEquals(709040760, c.hashCode(Path.Type.file, new PathAttributes().setETag("1").setModificationDate(1680879106939L)));
|
||||
assertEquals(709040760, c.hashCode(Path.Type.file, new PathAttributes().setETag("1").setModificationDate(1680879106000L)));
|
||||
assertEquals(Comparison.local, c.compare(Path.Type.file, new PathAttributes().setETag("1").setSize(1000L).setModificationDate(1680879107939L), new PathAttributes().setETag("2").setSize(1000L).setModificationDate(1680879106939L)));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.file, new DefaultPathAttributes().setETag("1"), new DefaultPathAttributes().setETag("1")));
|
||||
assertEquals(1519, c.hashCode(Path.Type.file, new DefaultPathAttributes().setETag("1")));
|
||||
assertEquals(Comparison.unknown, c.compare(Path.Type.file, new DefaultPathAttributes().setETag("1"), new DefaultPathAttributes().setETag("2")));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.file, new DefaultPathAttributes().setETag("1").setSize(1000L), new DefaultPathAttributes().setETag("2").setSize(1000L)));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.file, new DefaultPathAttributes().setETag("1").setSize(1000L).setModificationDate(1680879106939L), new DefaultPathAttributes().setETag("2").setSize(1000L).setModificationDate(1680879106939L)));
|
||||
assertEquals(709040760, c.hashCode(Path.Type.file, new DefaultPathAttributes().setETag("1").setModificationDate(1680879106939L)));
|
||||
assertEquals(709040760, c.hashCode(Path.Type.file, new DefaultPathAttributes().setETag("1").setModificationDate(1680879106000L)));
|
||||
assertEquals(Comparison.local, c.compare(Path.Type.file, new DefaultPathAttributes().setETag("1").setSize(1000L).setModificationDate(1680879107939L), new DefaultPathAttributes().setETag("2").setSize(1000L).setModificationDate(1680879106939L)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -47,13 +48,13 @@ public class DefaultComparisonServiceTest {
|
||||
return DirectoryTimestamp.implicit;
|
||||
}
|
||||
});
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.directory, new PathAttributes().setETag("1"), new PathAttributes().setETag("1")));
|
||||
assertEquals(1519, c.hashCode(Path.Type.directory, new PathAttributes().setETag("1")));
|
||||
assertEquals(Comparison.notequal, c.compare(Path.Type.directory, new PathAttributes().setETag("1"), new PathAttributes().setETag("2")));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.directory, new PathAttributes().setModificationDate(1680879106939L), new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(1546892887, c.hashCode(Path.Type.directory, new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(1546892887, c.hashCode(Path.Type.directory, new PathAttributes().setModificationDate(1680879106000L)));
|
||||
assertEquals(Comparison.local, c.compare(Path.Type.directory, new PathAttributes().setModificationDate(1680879107939L), new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.directory, new DefaultPathAttributes().setETag("1"), new DefaultPathAttributes().setETag("1")));
|
||||
assertEquals(1519, c.hashCode(Path.Type.directory, new DefaultPathAttributes().setETag("1")));
|
||||
assertEquals(Comparison.notequal, c.compare(Path.Type.directory, new DefaultPathAttributes().setETag("1"), new DefaultPathAttributes().setETag("2")));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.directory, new DefaultPathAttributes().setModificationDate(1680879106939L), new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(1546892887, c.hashCode(Path.Type.directory, new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(1546892887, c.hashCode(Path.Type.directory, new DefaultPathAttributes().setModificationDate(1680879106000L)));
|
||||
assertEquals(Comparison.local, c.compare(Path.Type.directory, new DefaultPathAttributes().setModificationDate(1680879107939L), new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
}
|
||||
{
|
||||
final DefaultComparisonService c = new DefaultComparisonService(new TestProtocol() {
|
||||
@@ -62,20 +63,20 @@ public class DefaultComparisonServiceTest {
|
||||
return DirectoryTimestamp.explicit;
|
||||
}
|
||||
});
|
||||
assertEquals(0, c.hashCode(Path.Type.directory, new PathAttributes()));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.directory, new PathAttributes().setETag("1"), new PathAttributes().setETag("1")));
|
||||
assertEquals(1519, c.hashCode(Path.Type.directory, new PathAttributes().setETag("1")));
|
||||
assertEquals(Comparison.notequal, c.compare(Path.Type.directory, new PathAttributes().setETag("1"), new PathAttributes().setETag("2")));
|
||||
assertEquals(Comparison.unknown, c.compare(Path.Type.directory, new PathAttributes().setModificationDate(1680879106939L), new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(0, c.hashCode(Path.Type.directory, new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(Comparison.unknown, c.compare(Path.Type.directory, new PathAttributes().setModificationDate(1680879107939L), new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(0, c.hashCode(Path.Type.directory, new DefaultPathAttributes()));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.directory, new DefaultPathAttributes().setETag("1"), new DefaultPathAttributes().setETag("1")));
|
||||
assertEquals(1519, c.hashCode(Path.Type.directory, new DefaultPathAttributes().setETag("1")));
|
||||
assertEquals(Comparison.notequal, c.compare(Path.Type.directory, new DefaultPathAttributes().setETag("1"), new DefaultPathAttributes().setETag("2")));
|
||||
assertEquals(Comparison.unknown, c.compare(Path.Type.directory, new DefaultPathAttributes().setModificationDate(1680879106939L), new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(0, c.hashCode(Path.Type.directory, new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(Comparison.unknown, c.compare(Path.Type.directory, new DefaultPathAttributes().setModificationDate(1680879107939L), new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareSymlink() {
|
||||
final DefaultComparisonService c = new DefaultComparisonService(new TestProtocol());
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.symboliclink, new PathAttributes().setModificationDate(1680879106939L), new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(Comparison.local, c.compare(Path.Type.symboliclink, new PathAttributes().setModificationDate(1680879107939L), new PathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(Comparison.equal, c.compare(Path.Type.symboliclink, new DefaultPathAttributes().setModificationDate(1680879106939L), new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
assertEquals(Comparison.local, c.compare(Path.Type.symboliclink, new DefaultPathAttributes().setModificationDate(1680879107939L), new DefaultPathAttributes().setModificationDate(1680879106939L)));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package ch.cyberduck.core.synchronization;
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
|
||||
@@ -12,9 +13,9 @@ public class SizeComparisonServiceTest {
|
||||
@Test
|
||||
public void testCompare() {
|
||||
ComparisonService s = new SizeComparisonService();
|
||||
assertEquals(Comparison.remote, s.compare(Path.Type.file, new PathAttributes().setSize(0L), new PathAttributes().setSize(1L)));
|
||||
assertEquals(Comparison.local, s.compare(Path.Type.file, new PathAttributes().setSize(1L), new PathAttributes().setSize(0L)));
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new PathAttributes().setSize(1L), new PathAttributes().setSize(1L)));
|
||||
assertEquals(Comparison.notequal, s.compare(Path.Type.file, new PathAttributes().setSize(2L), new PathAttributes().setSize(1L)));
|
||||
assertEquals(Comparison.remote, s.compare(Path.Type.file, new DefaultPathAttributes().setSize(0L), new DefaultPathAttributes().setSize(1L)));
|
||||
assertEquals(Comparison.local, s.compare(Path.Type.file, new DefaultPathAttributes().setSize(1L), new DefaultPathAttributes().setSize(0L)));
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new DefaultPathAttributes().setSize(1L), new DefaultPathAttributes().setSize(1L)));
|
||||
assertEquals(Comparison.notequal, s.compare(Path.Type.file, new DefaultPathAttributes().setSize(2L), new DefaultPathAttributes().setSize(1L)));
|
||||
}
|
||||
}
|
||||
|
||||
+8
-6
@@ -1,5 +1,6 @@
|
||||
package ch.cyberduck.core.synchronization;
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
|
||||
@@ -17,12 +18,12 @@ public class TimestampComparisonServiceTest {
|
||||
public void testCompareEqual() {
|
||||
TimestampComparisonService s = new TimestampComparisonService();
|
||||
final long timestamp = System.currentTimeMillis();
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new PathAttributes().setModificationDate(timestamp), new PathAttributes().setModificationDate(timestamp)));
|
||||
final int hashCode = s.hashCode(Path.Type.file, new PathAttributes().setModificationDate(timestamp));
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new PathAttributes().setModificationDate(timestamp), new PathAttributes().setModificationDate(
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new DefaultPathAttributes().setModificationDate(timestamp), new DefaultPathAttributes().setModificationDate(timestamp)));
|
||||
final int hashCode = s.hashCode(Path.Type.file, new DefaultPathAttributes().setModificationDate(timestamp));
|
||||
assertEquals(Comparison.equal, s.compare(Path.Type.file, new DefaultPathAttributes().setModificationDate(timestamp), new DefaultPathAttributes().setModificationDate(
|
||||
TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(timestamp))
|
||||
)));
|
||||
assertEquals(hashCode, s.hashCode(Path.Type.file, new PathAttributes().setModificationDate(
|
||||
assertEquals(hashCode, s.hashCode(Path.Type.file, new DefaultPathAttributes().setModificationDate(
|
||||
TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(timestamp))
|
||||
)));
|
||||
}
|
||||
@@ -32,8 +33,9 @@ public class TimestampComparisonServiceTest {
|
||||
TimestampComparisonService s = new TimestampComparisonService();
|
||||
final long timestamp = Calendar.getInstance(TimeZone.getDefault()).getTimeInMillis();
|
||||
assertEquals(Comparison.local, s.compare(Path.Type.file,
|
||||
new PathAttributes().setModificationDate(timestamp),
|
||||
new PathAttributes() {
|
||||
new DefaultPathAttributes().setModificationDate(timestamp),
|
||||
new
|
||||
DefaultPathAttributes() {
|
||||
@Override
|
||||
public long getModificationDate() {
|
||||
final Calendar c = Calendar.getInstance(TimeZone.getDefault());
|
||||
|
||||
@@ -18,20 +18,7 @@ package ch.cyberduck.core.transfer;
|
||||
* dkocher@cyberduck.ch
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Local;
|
||||
import ch.cyberduck.core.LocalAttributes;
|
||||
import ch.cyberduck.core.NullLocal;
|
||||
import ch.cyberduck.core.NullSession;
|
||||
import ch.cyberduck.core.NullTransferSession;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.PathCache;
|
||||
import ch.cyberduck.core.TestProtocol;
|
||||
import ch.cyberduck.core.*;
|
||||
import ch.cyberduck.core.local.DefaultLocalDirectoryFeature;
|
||||
import ch.cyberduck.core.synchronization.Comparison;
|
||||
|
||||
@@ -118,8 +105,8 @@ public class SyncTransferTest {
|
||||
@Test
|
||||
public void testFilterMirror() throws Exception {
|
||||
final Path p = new Path("t", EnumSet.of(Path.Type.directory));
|
||||
final Path a = new Path(p, "a", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setSize(2L));
|
||||
final Path b = new Path(p, "b", EnumSet.of(Path.Type.file)).withAttributes(new PathAttributes().setSize(1L));
|
||||
final Path a = new Path(p, "a", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setSize(2L));
|
||||
final Path b = new Path(p, "b", EnumSet.of(Path.Type.file)).withAttributes(new DefaultPathAttributes().setSize(1L));
|
||||
final PathCache cache = new PathCache(1);
|
||||
cache.put(p, new AttributedList<>(Arrays.asList(a, b)));
|
||||
SyncTransfer t = new SyncTransfer(new Host(new TestProtocol()), new TransferItem(p, new NullLocal(System.getProperty("java.io.tmpdir"), "t")));
|
||||
|
||||
@@ -393,7 +393,7 @@ public class UploadTransferTest {
|
||||
return (T) new AttributesFinder() {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
return new PathAttributes();
|
||||
return new DefaultPathAttributes();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ch.cyberduck.core.transfer.upload;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
@@ -144,7 +145,7 @@ public class OverwriteFilterTest {
|
||||
final AttributesFinder attributes = new AttributesFinder() {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
return new PathAttributes();
|
||||
return new DefaultPathAttributes();
|
||||
}
|
||||
};
|
||||
final Find find = new Find() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package ch.cyberduck.core.transfer.upload;
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
@@ -106,7 +107,7 @@ public class RenameExistingFilterTest {
|
||||
final AttributesFinder attributes = new AttributesFinder() {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
return new PathAttributes();
|
||||
return new DefaultPathAttributes();
|
||||
}
|
||||
};
|
||||
final Host host = new Host(new TestProtocol());
|
||||
@@ -189,7 +190,7 @@ public class RenameExistingFilterTest {
|
||||
final AttributesFinder attributes = new AttributesFinder() {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
return new PathAttributes();
|
||||
return new DefaultPathAttributes();
|
||||
}
|
||||
};
|
||||
final Host host = new Host(new TestProtocol());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ch.cyberduck.core.transfer.upload;
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
@@ -37,7 +38,7 @@ public class RenameFilterTest {
|
||||
final AttributesFinder attributes = new AttributesFinder() {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
return new PathAttributes();
|
||||
return new DefaultPathAttributes();
|
||||
}
|
||||
};
|
||||
final Find find = new Find() {
|
||||
@@ -78,7 +79,7 @@ public class RenameFilterTest {
|
||||
final AttributesFinder attributes = new AttributesFinder() {
|
||||
@Override
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) {
|
||||
return new PathAttributes();
|
||||
return new DefaultPathAttributes();
|
||||
}
|
||||
};
|
||||
final Find find = new Find() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ch.cyberduck.core.transfer.upload;
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
@@ -150,7 +151,7 @@ public class ResumeFilterTest {
|
||||
@Override
|
||||
public AttributedList<Path> list(final Path folder, final ListProgressListener listener) throws BackgroundException {
|
||||
final AttributedList<Path> list = new AttributedList<>(Collections.singletonList(new Path(folder, "t", EnumSet.of(Path.Type.file))
|
||||
.withAttributes(new PathAttributes().setSize(3L))));
|
||||
.withAttributes(new DefaultPathAttributes().setSize(3L))));
|
||||
listener.chunk(folder, list);
|
||||
return list;
|
||||
}
|
||||
@@ -189,7 +190,7 @@ public class ResumeFilterTest {
|
||||
@Override
|
||||
public AttributedList<Path> list(final Path folder, final ListProgressListener listener) throws BackgroundException {
|
||||
final AttributedList<Path> list = new AttributedList<>(Collections.singletonList(new Path(folder, "t", EnumSet.of(Path.Type.file))
|
||||
.withAttributes(new PathAttributes().setSize(2L))));
|
||||
.withAttributes(new DefaultPathAttributes().setSize(2L))));
|
||||
listener.chunk(folder, list);
|
||||
return list;
|
||||
}
|
||||
@@ -234,7 +235,7 @@ public class ResumeFilterTest {
|
||||
@Override
|
||||
public AttributedList<Path> list(final Path folder, final ListProgressListener listener) throws BackgroundException {
|
||||
final AttributedList<Path> list = new AttributedList<>(Collections.singletonList(new Path(folder, "t", EnumSet.of(Path.Type.file))
|
||||
.withAttributes(new PathAttributes().setSize(4L))));
|
||||
.withAttributes(new DefaultPathAttributes().setSize(4L))));
|
||||
listener.chunk(folder, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.worker;
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
@@ -84,7 +85,7 @@ public class MoveWorkerTest {
|
||||
if(type == Move.class) {
|
||||
return (T) new Move() {
|
||||
private final AtomicInteger count = new AtomicInteger();
|
||||
private final PathAttributes attr = new PathAttributes().setSize(1L);
|
||||
private final PathAttributes attr = new DefaultPathAttributes().setSize(1L);
|
||||
|
||||
@Override
|
||||
public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ch.cyberduck.core.worker;
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.NullSession;
|
||||
@@ -210,7 +211,8 @@ public class WriteMetadataWorkerTest {
|
||||
|
||||
@Test
|
||||
public void testRunDifferent() throws Exception {
|
||||
final PathAttributes attributesA = new PathAttributes();
|
||||
final PathAttributes attributesA = new
|
||||
DefaultPathAttributes();
|
||||
{
|
||||
final Map<String, String> map = new HashMap<>();
|
||||
map.put("equal", "equal");
|
||||
@@ -218,7 +220,7 @@ public class WriteMetadataWorkerTest {
|
||||
map.put("unique", "unique");
|
||||
attributesA.setMetadata(map);
|
||||
}
|
||||
final PathAttributes attributesB = new PathAttributes();
|
||||
final PathAttributes attributesB = new DefaultPathAttributes();
|
||||
{
|
||||
final Map<String, String> map = new HashMap<>();
|
||||
map.put("equal", "equal");
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.ui.browser;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
|
||||
@@ -62,6 +63,6 @@ public class RecursiveSearchFilterTest {
|
||||
@Test
|
||||
public void testAcceptFileVersions() {
|
||||
final RecursiveSearchFilter f = new RecursiveSearchFilter(new AttributedList<>(Arrays.asList(new Path("/f", EnumSet.of(Path.Type.file)))));
|
||||
assertTrue(f.accept(new Path("/f", EnumSet.of(Path.Type.file), new PathAttributes().setVersionId("1"))));
|
||||
assertTrue(f.accept(new Path("/f", EnumSet.of(Path.Type.file), new DefaultPathAttributes().setVersionId("1"))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.ui.browser;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
|
||||
@@ -31,7 +32,7 @@ public class SizeTooltipServiceTest {
|
||||
@Test
|
||||
public void testGetTooltip() {
|
||||
final SizeTooltipService s = new SizeTooltipService();
|
||||
final PathAttributes attr = new PathAttributes();
|
||||
final PathAttributes attr = new DefaultPathAttributes();
|
||||
attr.setSize(-1L);
|
||||
assertEquals("--", s.getTooltip(new Path("/p", EnumSet.of(Path.Type.file), attr)));
|
||||
attr.setSize(0L);
|
||||
|
||||
@@ -126,10 +126,10 @@ public class CryptoVault implements Vault {
|
||||
final EnumSet<Path.Type> type = EnumSet.copyOf(home.getType());
|
||||
type.add(Path.Type.vault);
|
||||
if(home.isRoot()) {
|
||||
this.vault = new Path(home.getAbsolute(), type, new PathAttributes(home.attributes()));
|
||||
this.vault = new Path(home.getAbsolute(), type, new DefaultPathAttributes(home.attributes()));
|
||||
}
|
||||
else {
|
||||
this.vault = new Path(home.getParent(), home.getName(), type, new PathAttributes(home.attributes()));
|
||||
this.vault = new Path(home.getParent(), home.getName(), type, new DefaultPathAttributes(home.attributes()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ public class CryptoVault implements Vault {
|
||||
parent = directoryProvider.toEncrypted(session, file.getParent().attributes().getDirectoryId(), file.getParent());
|
||||
filename = directoryProvider.toEncrypted(session, parent.attributes().getDirectoryId(), file.getName(), file.getType());
|
||||
}
|
||||
final PathAttributes attributes = new PathAttributes(file.attributes());
|
||||
final PathAttributes attributes = new DefaultPathAttributes(file.attributes());
|
||||
attributes.setDirectoryId(null);
|
||||
if(!file.isFile() && !metadata) {
|
||||
// The directory is different from the metadata file used to resolve the actual folder
|
||||
@@ -484,7 +484,7 @@ public class CryptoVault implements Vault {
|
||||
final String cleartextFilename = fileNameCryptor.decryptFilename(
|
||||
vaultVersion == VAULT_VERSION_DEPRECATED ? BaseEncoding.base32() : BaseEncoding.base64Url(),
|
||||
ciphertext, file.getParent().attributes().getDirectoryId().getBytes(StandardCharsets.UTF_8));
|
||||
final PathAttributes attributes = new PathAttributes(file.attributes());
|
||||
final PathAttributes attributes = new DefaultPathAttributes(file.attributes());
|
||||
if(this.isDirectory(inflated)) {
|
||||
if(Permission.EMPTY != attributes.getPermission()) {
|
||||
final Permission permission = new Permission(attributes.getPermission());
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ package ch.cyberduck.core.cryptomator.features;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.MemoryListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -41,7 +42,7 @@ public class CryptoAttributesFeature implements AttributesFinder {
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) throws BackgroundException {
|
||||
final MemoryListProgressListener memory = new MemoryListProgressListener();
|
||||
// Fetch with any directory listing stored in memory encrypted
|
||||
final PathAttributes attributes = new PathAttributes(delegate.find(vault.encrypt(session, file, true), memory));
|
||||
final PathAttributes attributes = new DefaultPathAttributes(delegate.find(vault.encrypt(session, file, true), memory));
|
||||
final Path directory = file.getParent();
|
||||
// Decrypt directory listing and forward to proxy
|
||||
new DecryptingListProgressListener(session, vault, directory, listener).chunk(directory, memory.getContents());
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ package ch.cyberduck.core.cryptomator.features;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.Session;
|
||||
@@ -73,7 +74,7 @@ public class CryptoCopyFeature implements Copy {
|
||||
public TransferStatus setResponse(final PathAttributes attributes) {
|
||||
status.setResponse(attributes);
|
||||
// Will be converted back to clear text when decrypting file below set in default copy feature implementation using writer.
|
||||
super.setResponse(new PathAttributes(attributes).setSize(vault.toCiphertextSize(0L, attributes.getSize())));
|
||||
super.setResponse(new DefaultPathAttributes(attributes).setSize(vault.toCiphertextSize(0L, attributes.getSize())));
|
||||
return this;
|
||||
}
|
||||
} : status,
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ package ch.cyberduck.core.cryptomator.features;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -54,7 +55,7 @@ public class CryptoTouchFeature<Reply> implements Touch<Reply> {
|
||||
public TransferStatus setResponse(final PathAttributes attributes) {
|
||||
status.setResponse(attributes);
|
||||
// Will be converted back to clear text when decrypting file below set in default touch feature implementation using writer.
|
||||
super.setResponse(new PathAttributes(attributes).setSize(vault.toCiphertextSize(0L, attributes.getSize())));
|
||||
super.setResponse(new DefaultPathAttributes(attributes).setSize(vault.toCiphertextSize(0L, attributes.getSize())));
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ package ch.cyberduck.core.cryptomator.impl;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.CacheReference;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.RandomStringService;
|
||||
@@ -78,7 +79,7 @@ public class CryptoDirectoryV6Provider implements CryptoDirectory {
|
||||
throw new NotfoundException(directory.getAbsolute());
|
||||
}
|
||||
if(new SimplePathPredicate(directory).test(home) || directory.isChild(home)) {
|
||||
final PathAttributes attributes = new PathAttributes(directory.attributes());
|
||||
final PathAttributes attributes = new DefaultPathAttributes(directory.attributes());
|
||||
// The root of the vault is a different target directory and file ids always correspond to the metadata file
|
||||
attributes.setVersionId(null);
|
||||
attributes.setFileId(null);
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.ctera;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -77,7 +78,7 @@ public class CteraCopyFeatureTest extends AbstractCteraTest {
|
||||
target.getParent().setAttributes(target.getParent().attributes().setAcl(new Acl(new Acl.CanonicalUser(), CteraAttributesFinderFeature.CREATEDIRECTORIESPERMISSION)));
|
||||
final CteraAttributesFinderFeature mock = mock(CteraAttributesFinderFeature.class);
|
||||
// target exists and not writable
|
||||
when(mock.find(eq(target))).thenReturn(new PathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
when(mock.find(eq(target))).thenReturn(new DefaultPathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
final AccessDeniedException accessDeniedException = assertThrows(AccessDeniedException.class, () -> new CteraCopyFeature(session).preflight(source, Optional.of(target)));
|
||||
assertTrue(accessDeniedException.getDetail().contains(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), target.getName())));
|
||||
}
|
||||
@@ -92,7 +93,7 @@ public class CteraCopyFeatureTest extends AbstractCteraTest {
|
||||
target.getParent().setAttributes(target.getParent().attributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
final CteraAttributesFinderFeature mock = mock(CteraAttributesFinderFeature.class);
|
||||
// target exists and not writable
|
||||
when(mock.find(eq(target))).thenReturn(new PathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
when(mock.find(eq(target))).thenReturn(new DefaultPathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
final AccessDeniedException accessDeniedException = assertThrows(AccessDeniedException.class, () -> new CteraCopyFeature(session).preflight(source, Optional.of(target)));
|
||||
assertTrue(accessDeniedException.getDetail().contains(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), target.getName())));
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package ch.cyberduck.core.ctera;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
@@ -178,7 +179,7 @@ public class CteraMoveFeatureTest extends AbstractCteraTest {
|
||||
target.getParent().setAttributes(target.getParent().attributes().setAcl(new Acl(new Acl.CanonicalUser(), CteraAttributesFinderFeature.CREATEDIRECTORIESPERMISSION)));
|
||||
final CteraAttributesFinderFeature mock = mock(CteraAttributesFinderFeature.class);
|
||||
// target exists and not writable
|
||||
when(mock.find(eq(target))).thenReturn(new PathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
when(mock.find(eq(target))).thenReturn(new DefaultPathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
final AccessDeniedException accessDeniedException = assertThrows(AccessDeniedException.class, () -> new CteraMoveFeature(session).preflight(source, Optional.of(target)));
|
||||
assertTrue(accessDeniedException.getDetail().contains(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), target.getName())));
|
||||
}
|
||||
@@ -204,7 +205,7 @@ public class CteraMoveFeatureTest extends AbstractCteraTest {
|
||||
target.getParent().setAttributes(target.getParent().attributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
final CteraAttributesFinderFeature mock = mock(CteraAttributesFinderFeature.class);
|
||||
// target exists and not writable
|
||||
when(mock.find(eq(target))).thenReturn(new PathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
when(mock.find(eq(target))).thenReturn(new DefaultPathAttributes().setAcl(new Acl(new Acl.CanonicalUser())));
|
||||
final AccessDeniedException accessDeniedException = assertThrows(AccessDeniedException.class, () -> new CteraMoveFeature(session).preflight(source, Optional.of(target)));
|
||||
assertTrue(accessDeniedException.getDetail().contains(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), target.getName())));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.deepbox;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -146,7 +147,7 @@ public class DeepboxAttributesFinderFeature implements AttributesFinder, Attribu
|
||||
final String boxNodeId = fileid.getBoxNodeId(file);
|
||||
// map BoxAccessPolicy to CANLISTCHILDREN and CANADDCHILDREN for third level
|
||||
final Box box = new BoxRestControllerApi(session.getClient()).getBox(deepBoxNodeId, boxNodeId);
|
||||
final PathAttributes attr = new PathAttributes().setFileId(fileId);
|
||||
final PathAttributes attr = new DefaultPathAttributes().setFileId(fileId);
|
||||
final Acl acl = new Acl(new Acl.CanonicalUser());
|
||||
final BoxAccessPolicy boxPolicy = box.getBoxPolicy();
|
||||
if(containerService.isInbox(file)) {
|
||||
@@ -200,26 +201,26 @@ public class DeepboxAttributesFinderFeature implements AttributesFinder, Attribu
|
||||
}
|
||||
|
||||
public PathAttributes toAttributes(final Box box) {
|
||||
final PathAttributes attrs = new PathAttributes();
|
||||
final PathAttributes attrs = new DefaultPathAttributes();
|
||||
attrs.setFileId(box.getBoxNodeId());
|
||||
return attrs;
|
||||
}
|
||||
|
||||
public PathAttributes toAttributes(final DeepBox deepBox) {
|
||||
final PathAttributes attrs = new PathAttributes();
|
||||
final PathAttributes attrs = new DefaultPathAttributes();
|
||||
attrs.setFileId(deepBox.getDeepBoxNodeId());
|
||||
return attrs;
|
||||
}
|
||||
|
||||
public PathAttributes toAttributes(final CompanyRoles company) {
|
||||
final PathAttributes attrs = new PathAttributes();
|
||||
final PathAttributes attrs = new DefaultPathAttributes();
|
||||
attrs.setFileId(company.getGroupId());
|
||||
return attrs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final Node node) {
|
||||
final PathAttributes attrs = new PathAttributes();
|
||||
final PathAttributes attrs = new DefaultPathAttributes();
|
||||
attrs.setFileId(node.getNodeId());
|
||||
attrs.setCreationDate(node.getCreated().getTime().getMillis());
|
||||
attrs.setModificationDate(node.getModified().getTime().getMillis());
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.deepbox;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.CachingFileIdProvider;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.deepbox.io.swagger.client.ApiException;
|
||||
@@ -135,7 +136,7 @@ public class DeepboxIdProvider extends CachingFileIdProvider implements FileIdPr
|
||||
return file;
|
||||
}
|
||||
}
|
||||
final Path deepbox = new Path(result, deepboxName, type, new PathAttributes(combined.attributes()).setFileId(null));
|
||||
final Path deepbox = new Path(result, deepboxName, type, new DefaultPathAttributes(combined.attributes()).setFileId(null));
|
||||
result = new Path(deepbox, boxName, type, segment.attributes());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.deepbox;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.ListService;
|
||||
@@ -359,7 +360,7 @@ public class DeepboxListService implements ListService {
|
||||
list.add(new Path(directory,
|
||||
String.format("%s (%s)", DeepboxPathNormalizer.name(box.getCompany().getDisplayName()), DeepboxPathNormalizer.name(box.getBoxName())),
|
||||
EnumSet.of(Path.Type.directory, Path.Type.volume),
|
||||
new PathAttributes().setFileId(box.getBoxNodeId()).setCustom(DeepboxIdProvider.DEEPBOX_NAME_PROEPRTY_KEY, box.getDeepBoxName()))
|
||||
new DefaultPathAttributes().setFileId(box.getBoxNodeId()).setCustom(DeepboxIdProvider.DEEPBOX_NAME_PROEPRTY_KEY, box.getDeepBoxName()))
|
||||
);
|
||||
}
|
||||
// Mark duplicates
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.deepbox;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -74,7 +75,7 @@ public class DeepboxMoveFeature implements Move {
|
||||
}
|
||||
fileid.cache(file, null);
|
||||
fileid.cache(renamed, sourceId);
|
||||
return new Path(renamed).withAttributes(new PathAttributes(file.attributes()).setFileId(sourceId));
|
||||
return new Path(renamed).withAttributes(new DefaultPathAttributes(file.attributes()).setFileId(sourceId));
|
||||
}
|
||||
catch(ApiException e) {
|
||||
throw new DeepboxExceptionMappingService(fileid).map("Cannot rename {0}", e, file);
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.deepbox;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -48,12 +49,12 @@ public class DeepboxCopyFeatureTest extends AbstractDeepboxTest {
|
||||
final Path copy = new Path(documents, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
|
||||
new DeepboxCopyFeature(session, fileid).copy(test, copy, new TransferStatus(), new DisabledConnectionCallback(), new DisabledStreamListener());
|
||||
try {
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(copy.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(copy.withAttributes(new DefaultPathAttributes())));
|
||||
}
|
||||
finally {
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(test.withAttributes(new PathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(copy.withAttributes(new PathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(test.withAttributes(new DefaultPathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(copy.withAttributes(new DefaultPathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ public class DeepboxCopyFeatureTest extends AbstractDeepboxTest {
|
||||
new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
|
||||
final Path copy = new Path(documents, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
|
||||
assertThrows(UnsupportedException.class, () -> new DeepboxCopyFeature(session, fileid).preflight(directory, Optional.of(copy)));
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(directory.withAttributes(new PathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(directory.withAttributes(new DefaultPathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -94,17 +95,17 @@ public class DeepboxCopyFeatureTest extends AbstractDeepboxTest {
|
||||
final PathAttributes originalTargetAttributes = new DeepboxAttributesFinderFeature(session, fileid).find(target);
|
||||
|
||||
new DeepboxCopyFeature(session, fileid).copy(test, target, new TransferStatus().setExists(true), new DisabledConnectionCallback(), new DisabledStreamListener());
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(target.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(target.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(targetInTrash));
|
||||
|
||||
final PathAttributes overriddenTargetAttributes = new DeepboxAttributesFinderFeature(session, fileid).find(target.withAttributes(new PathAttributes()));
|
||||
final PathAttributes overriddenTargetAttributes = new DeepboxAttributesFinderFeature(session, fileid).find(target.withAttributes(new DefaultPathAttributes()));
|
||||
assertNotNull(originalTestAttributes.getFileId());
|
||||
assertNotEquals(originalTestAttributes.getFileId(), overriddenTargetAttributes.getFileId());
|
||||
assertNotEquals(originalTestAttributes.getModificationDate(), overriddenTargetAttributes.getModificationDate());
|
||||
assertEquals(originalTestAttributes.getChecksum(), overriddenTargetAttributes.getChecksum());
|
||||
|
||||
final PathAttributes trashedTargetAttributes = new DeepboxAttributesFinderFeature(session, fileid).find(targetInTrash.withAttributes(new PathAttributes()));
|
||||
final PathAttributes trashedTargetAttributes = new DeepboxAttributesFinderFeature(session, fileid).find(targetInTrash.withAttributes(new DefaultPathAttributes()));
|
||||
assertNotNull(originalTargetAttributes.getFileId());
|
||||
assertEquals(originalTargetAttributes.getFileId(), trashedTargetAttributes.getFileId());
|
||||
assertEquals(originalTargetAttributes.getModificationDate(), trashedTargetAttributes.getModificationDate());
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.deepbox;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -126,11 +127,11 @@ public class DeepboxDirectoryFeatureTest extends AbstractDeepboxTest {
|
||||
final Path parent = new Path("/ORG 4 - DeepBox Desktop App/ORG 4 - DeepBox Desktop App/ORG3:Box1/Documents", EnumSet.of(Path.Type.directory));
|
||||
final Path folder = new Path(parent, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
|
||||
directory.mkdir(new DeepboxWriteFeature(session, nodeid), folder, new TransferStatus());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(folder.withAttributes(new PathAttributes()), new DisabledListProgressListener()));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(folder.withAttributes(new DefaultPathAttributes()), new DisabledListProgressListener()));
|
||||
assertEquals(0, new DeepboxListService(session, nodeid).list(folder, new DisabledListProgressListener()).size());
|
||||
new DeepboxDeleteFeature(session, nodeid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertThrows(NotfoundException.class, () -> nodeid.getFileId(folder.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(folder.withAttributes(new PathAttributes())));
|
||||
assertThrows(NotfoundException.class, () -> nodeid.getFileId(folder.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(folder.withAttributes(new DefaultPathAttributes())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,6 +18,7 @@ package ch.cyberduck.core.deepbox;
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -71,7 +72,7 @@ public class DeepboxListServiceTest extends AbstractDeepboxTest {
|
||||
// no modification/creation date for DeepBoxes
|
||||
assertTrue(f.attributes().getModificationDate() < 0);
|
||||
assertTrue(f.attributes().getCreationDate() < 0);
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new PathAttributes())));
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(f.attributes(), new DeepboxAttributesFinderFeature(session, nodeid).find(new Path(f.getAbsolute(), f.getType())));
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,7 @@ public class DeepboxListServiceTest extends AbstractDeepboxTest {
|
||||
// no modification/creation date for Companies
|
||||
assertTrue(f.attributes().getModificationDate() < 0);
|
||||
assertTrue(f.attributes().getCreationDate() < 0);
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new PathAttributes())));
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(f.attributes(), new DeepboxAttributesFinderFeature(session, nodeid).find(new Path(f.getAbsolute(), f.getType())));
|
||||
}
|
||||
}
|
||||
@@ -131,7 +132,7 @@ public class DeepboxListServiceTest extends AbstractDeepboxTest {
|
||||
// no modification/creation date for Boxes
|
||||
assertTrue(f.attributes().getModificationDate() < 0);
|
||||
assertTrue(f.attributes().getCreationDate() < 0);
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new PathAttributes())));
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(f.attributes(), new DeepboxAttributesFinderFeature(session, nodeid).find(new Path(f.getAbsolute(), f.getType())));
|
||||
}
|
||||
}
|
||||
@@ -151,7 +152,7 @@ public class DeepboxListServiceTest extends AbstractDeepboxTest {
|
||||
// no modification/creation date for Boxes
|
||||
assertTrue(f.attributes().getModificationDate() < 0);
|
||||
assertTrue(f.attributes().getCreationDate() < 0);
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new PathAttributes())));
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(f.attributes(), new DeepboxAttributesFinderFeature(session, nodeid).find(new Path(f.getAbsolute(), f.getType())));
|
||||
}
|
||||
}
|
||||
@@ -198,7 +199,7 @@ public class DeepboxListServiceTest extends AbstractDeepboxTest {
|
||||
assertFalse(f.getName().contains(String.valueOf(Path.DELIMITER)));
|
||||
assertTrue(f.attributes().getModificationDate() > 0);
|
||||
assertTrue(f.attributes().getCreationDate() > 0);
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new PathAttributes())));
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(f.attributes(), new DeepboxAttributesFinderFeature(session, nodeid).find(f));
|
||||
}
|
||||
}
|
||||
@@ -215,7 +216,7 @@ public class DeepboxListServiceTest extends AbstractDeepboxTest {
|
||||
assertFalse(f.getName().contains(String.valueOf(Path.DELIMITER)));
|
||||
assertTrue(f.attributes().getModificationDate() > 0);
|
||||
assertTrue(f.attributes().getCreationDate() > 0);
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new PathAttributes())));
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(f.attributes(), new DeepboxAttributesFinderFeature(session, nodeid).find(new Path(f.getAbsolute(), f.getType())));
|
||||
}
|
||||
}
|
||||
@@ -245,7 +246,7 @@ public class DeepboxListServiceTest extends AbstractDeepboxTest {
|
||||
assertFalse(f.getName().contains(String.valueOf(Path.DELIMITER)));
|
||||
assertTrue(f.attributes().getModificationDate() > 0);
|
||||
assertTrue(f.attributes().getCreationDate() > 0);
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new PathAttributes())));
|
||||
assertNotNull(nodeid.getFileId(new Path(f).withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(f.attributes(), new DeepboxAttributesFinderFeature(session, nodeid).find(f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.deepbox;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.DisabledPasswordCallback;
|
||||
@@ -61,7 +62,7 @@ public class DeepboxMoveFeatureTest extends AbstractDeepboxTest {
|
||||
final Path moved = new DeepboxMoveFeature(session, fileid).move(test,
|
||||
new Path(documents, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
|
||||
assertEquals(sourceId, moved.attributes().getFileId());
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(new Path(test).withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(new Path(test).withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(moved));
|
||||
assertEquals(test.attributes().getModificationDate(), moved.attributes().getModificationDate());
|
||||
assertEquals(test.attributes().getChecksum(), moved.attributes().getChecksum());
|
||||
@@ -80,7 +81,7 @@ public class DeepboxMoveFeatureTest extends AbstractDeepboxTest {
|
||||
final Path target = new Path(documents, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory));
|
||||
final Path moved = new DeepboxMoveFeature(session, fileid).move(test, target, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
|
||||
assertEquals(sourceId, moved.attributes().getFileId());
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(target));
|
||||
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(target), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.deepbox;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -48,24 +49,24 @@ public class DeepboxRestoreFeatureTest extends AbstractDeepboxTest {
|
||||
new DeepboxTouchFeature(session, fileid).touch(new DeepboxWriteFeature(session, fileid), test, new TransferStatus());
|
||||
final String nodeId = new DeepboxAttributesFinderFeature(session, fileid).find(test).getFileId();
|
||||
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
|
||||
new DeepboxTrashFeature(session, fileid).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(testInTrash.withAttributes(new PathAttributes())).getFileId());
|
||||
assertThrows(NotfoundException.class, () -> new DeepboxAttributesFinderFeature(session, fileid).find(test.withAttributes(new PathAttributes())));
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(testInTrash.withAttributes(new PathAttributes())).getFileId());
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(testInTrash.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
assertThrows(NotfoundException.class, () -> new DeepboxAttributesFinderFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(testInTrash.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
|
||||
final DeepboxRestoreFeature restore = new DeepboxRestoreFeature(session, fileid);
|
||||
restore.restore(testInTrash, new DisabledLoginCallback());
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(test.withAttributes(new PathAttributes())).getFileId());
|
||||
assertThrows(NotfoundException.class, () -> new DeepboxAttributesFinderFeature(session, fileid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(test.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
assertThrows(NotfoundException.class, () -> new DeepboxAttributesFinderFeature(session, fileid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(test.withAttributes(new PathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(test.withAttributes(new DefaultPathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -91,40 +92,40 @@ public class DeepboxRestoreFeatureTest extends AbstractDeepboxTest {
|
||||
|
||||
new DeepboxTouchFeature(session, fileid).touch(new DeepboxWriteFeature(session, fileid), file, new TransferStatus());
|
||||
final String nodeId = new DeepboxAttributesFinderFeature(session, fileid).find(file).getFileId();
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(folder.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(subfolderWithContent.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(folder.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(subfolderWithContent.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(file));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(folderInTrash.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(fileInTrash.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(folderInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(fileInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
|
||||
new DeepboxTrashFeature(session, fileid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
|
||||
assertThrows(NotfoundException.class, () -> fileid.getFileId(folder.withAttributes(new PathAttributes())));
|
||||
assertThrows(NotfoundException.class, () -> fileid.getFileId(subfolderWithContent.withAttributes(new PathAttributes())));
|
||||
assertThrows(NotfoundException.class, () -> fileid.getFileId(file.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(folder.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(subfolderWithContent.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(file.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(folderInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(fileInTrash.withAttributes(new PathAttributes())));
|
||||
assertEquals(folderId, new DeepboxAttributesFinderFeature(session, fileid).find(folderInTrash.withAttributes(new PathAttributes())).getFileId());
|
||||
assertEquals(subFolderId, new DeepboxAttributesFinderFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new PathAttributes())).getFileId());
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(fileInTrash.withAttributes(new PathAttributes())).getFileId());
|
||||
assertThrows(NotfoundException.class, () -> fileid.getFileId(folder.withAttributes(new DefaultPathAttributes())));
|
||||
assertThrows(NotfoundException.class, () -> fileid.getFileId(subfolderWithContent.withAttributes(new DefaultPathAttributes())));
|
||||
assertThrows(NotfoundException.class, () -> fileid.getFileId(file.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(folder.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(subfolderWithContent.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(file.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(folderInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(fileInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(folderId, new DeepboxAttributesFinderFeature(session, fileid).find(folderInTrash.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
assertEquals(subFolderId, new DeepboxAttributesFinderFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(fileInTrash.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
|
||||
final DeepboxRestoreFeature restore = new DeepboxRestoreFeature(session, fileid);
|
||||
restore.restore(folderInTrash, new DisabledLoginCallback());
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(folder.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(subfolderWithContent.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(file.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(folderInTrash.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(fileInTrash.withAttributes(new PathAttributes())));
|
||||
assertEquals(folderId, new DeepboxAttributesFinderFeature(session, fileid).find(folder.withAttributes(new PathAttributes())).getFileId());
|
||||
assertEquals(subFolderId, new DeepboxAttributesFinderFeature(session, fileid).find(subfolderWithContent.withAttributes(new PathAttributes())).getFileId());
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(file.withAttributes(new PathAttributes())).getFileId());
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(folder.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(subfolderWithContent.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, fileid).find(file.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(folderInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(subfolderWithContentInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, fileid).find(fileInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertEquals(folderId, new DeepboxAttributesFinderFeature(session, fileid).find(folder.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
assertEquals(subFolderId, new DeepboxAttributesFinderFeature(session, fileid).find(subfolderWithContent.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
assertEquals(nodeId, new DeepboxAttributesFinderFeature(session, fileid).find(file.withAttributes(new DefaultPathAttributes())).getFileId());
|
||||
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(folder.withAttributes(new PathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new DeepboxDeleteFeature(session, fileid).delete(Collections.singletonList(folder.withAttributes(new DefaultPathAttributes())), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.deepbox;
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.DisabledPasswordCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -84,11 +85,11 @@ public class DeepboxTrashFeatureTest extends AbstractDeepboxTest {
|
||||
new DeepboxTouchFeature(session, nodeid).touch(new DeepboxWriteFeature(session, nodeid), file, new TransferStatus());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(file));
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(folder.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(folder.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DefaultFindFeature(session).find(folder));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(subfolderWithContent.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(subfolderWithContent.withAttributes(new DefaultPathAttributes())));
|
||||
assertThrows(NotfoundException.class, () -> new DefaultFindFeature(session).find(subfolderWithContent));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(file.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(file.withAttributes(new DefaultPathAttributes())));
|
||||
// file not in trash is deleted but not purged (i.e. moved to the trash)
|
||||
final Path folderInTrash = new Path(trash, folder.getName(), EnumSet.of(Path.Type.directory));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(folderInTrash));
|
||||
@@ -198,36 +199,36 @@ public class DeepboxTrashFeatureTest extends AbstractDeepboxTest {
|
||||
final Path testInTrash = new Path(trash, test.getName(), EnumSet.of(Path.Type.file));
|
||||
|
||||
new DeepboxTouchFeature(session, nodeid).touch(new DeepboxWriteFeature(session, nodeid), test, new TransferStatus());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new PathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new DefaultPathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxRestoreFeature(session, nodeid).restore(testInTrash.withAttributes(new PathAttributes()), new DisabledLoginCallback());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxRestoreFeature(session, nodeid).restore(testInTrash.withAttributes(new DefaultPathAttributes()), new DisabledLoginCallback());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new PathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new DefaultPathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(testInTrash.withAttributes(new PathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(testInTrash.withAttributes(new DefaultPathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -239,37 +240,37 @@ public class DeepboxTrashFeatureTest extends AbstractDeepboxTest {
|
||||
final Path testInTrash = new Path(trash, test.getName(), EnumSet.of(Path.Type.directory));
|
||||
|
||||
new DeepboxDirectoryFeature(session, nodeid).mkdir(new DeepboxWriteFeature(session, nodeid), test, new TransferStatus());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new PathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new DefaultPathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxRestoreFeature(session, nodeid).restore(testInTrash.withAttributes(new PathAttributes()), new DisabledLoginCallback());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxRestoreFeature(session, nodeid).restore(testInTrash.withAttributes(new DefaultPathAttributes()), new DisabledLoginCallback());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new PathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test.withAttributes(new DefaultPathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(testInTrash).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(testInTrash.withAttributes(new PathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(testInTrash.withAttributes(new DefaultPathAttributes())), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -282,15 +283,15 @@ public class DeepboxTrashFeatureTest extends AbstractDeepboxTest {
|
||||
final Path testInTrash = new Path(trash, test.getName(), EnumSet.of(Path.Type.file));
|
||||
|
||||
new DeepboxTouchFeature(session, nodeid).touch(new DeepboxWriteFeature(session, nodeid), test, new TransferStatus());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -303,14 +304,14 @@ public class DeepboxTrashFeatureTest extends AbstractDeepboxTest {
|
||||
final Path testInTrash = new Path(trash, test.getName(), EnumSet.of(Path.Type.directory));
|
||||
|
||||
new DeepboxDirectoryFeature(session, nodeid).mkdir(new DeepboxWriteFeature(session, nodeid), test, new TransferStatus());
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertTrue(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANDELETE));
|
||||
assertTrue(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANPURGE));
|
||||
assertFalse(new DeepboxAttributesFinderFeature(session, nodeid).find(test).getAcl().get(new Acl.CanonicalUser()).contains(CANREVERT));
|
||||
|
||||
new DeepboxTrashFeature(session, nodeid).delete(Collections.singletonList(test), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new PathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(test.withAttributes(new DefaultPathAttributes())));
|
||||
assertFalse(new DeepboxFindFeature(session, nodeid).find(testInTrash.withAttributes(new DefaultPathAttributes())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.sds;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.Permission;
|
||||
@@ -46,7 +47,7 @@ public class SDSAttributesAdapter implements AttributesAdapter<Node> {
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final Node node) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setVersionId(String.valueOf(node.getId()));
|
||||
attributes.setRevision(node.getBranchVersion());
|
||||
if(node.isIsEncrypted() != null && !node.isIsEncrypted()) {
|
||||
@@ -107,7 +108,7 @@ public class SDSAttributesAdapter implements AttributesAdapter<Node> {
|
||||
}
|
||||
|
||||
public PathAttributes toAttributes(final DeletedNode node) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setDuplicate(true);
|
||||
attributes.setVersionId(String.valueOf(node.getId()));
|
||||
attributes.setCreationDate(node.getCreatedAt() != null ? node.getCreatedAt().getMillis() : -1L);
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.sds;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.Acl;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -53,7 +54,7 @@ public class SDSAttributesFinderFeature implements AttributesFinder {
|
||||
public PathAttributes find(final Path file, final ListProgressListener listener) throws BackgroundException {
|
||||
if(file.isRoot()) {
|
||||
// {"code":400,"message":"Bad Request","debugInfo":"Node ID must be positive.","errorCode":-80001}
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
if(session.userAccount().isUserInRole(SDSPermissionsFeature.ROOM_MANAGER_ROLE)) {
|
||||
// We need to map user roles to ACLs in order to decide if creating a top-level room is allowed
|
||||
final Acl acl = new Acl();
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.sds;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -102,7 +103,7 @@ public class SDSMoveFeature implements Move {
|
||||
nodeid.cache(renamed, file.attributes().getVersionId());
|
||||
nodeid.cache(file, null);
|
||||
// Copy original file attributes
|
||||
return new Path(renamed).withAttributes(new PathAttributes(file.attributes()).setVersionId(String.valueOf(nodeId)));
|
||||
return new Path(renamed).withAttributes(new DefaultPathAttributes(file.attributes()).setVersionId(String.valueOf(nodeId)));
|
||||
}
|
||||
}
|
||||
catch(ApiException e) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.sds;
|
||||
|
||||
import ch.cyberduck.core.AbstractPath;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.DisabledProgressListener;
|
||||
import ch.cyberduck.core.Local;
|
||||
@@ -61,7 +62,7 @@ public class SDSDeleteFeatureTest extends AbstractSDSTest {
|
||||
assertNotNull(versionId);
|
||||
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
try {
|
||||
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(file.withAttributes(new PathAttributes().setVersionId(versionId))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(file.withAttributes(new DefaultPathAttributes().setVersionId(versionId))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
fail();
|
||||
}
|
||||
catch(NotfoundException e) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.sds;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DefaultPathPredicate;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
@@ -50,7 +51,7 @@ public class SDSVersioningFeatureTest extends AbstractSDSTest {
|
||||
final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(
|
||||
new SDSDirectS3MultipartWriteFeature(session, nodeid), new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
|
||||
final Path test = new SDSTouchFeature(session, nodeid).touch(new SDSDirectS3MultipartWriteFeature(session, nodeid), new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
|
||||
final PathAttributes initialAttributes = new PathAttributes(test.attributes());
|
||||
final PathAttributes initialAttributes = new DefaultPathAttributes(test.attributes());
|
||||
final String initialVersion = test.attributes().getVersionId();
|
||||
final SDSVersioningFeature feature = new SDSVersioningFeature(session, nodeid);
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.dropbox;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -56,7 +57,7 @@ public class DropboxAttributesFinderFeature implements AttributesFinder, Attribu
|
||||
// Retrieve the namespace ID for a users home folder and team root folder
|
||||
final FullAccount account = new DbxUserUsersRequests(session.getClient()).getCurrentAccount();
|
||||
log.debug("Set root namespace {}", account.getRootInfo().getRootNamespaceId());
|
||||
return new PathAttributes().setFileId(account.getRootInfo().getRootNamespaceId());
|
||||
return new DefaultPathAttributes().setFileId(account.getRootInfo().getRootNamespaceId());
|
||||
}
|
||||
final Metadata metadata = new DbxUserFilesRequests(session.getClient(file)).getMetadata(containerService.getKey(file));
|
||||
if(metadata instanceof FileMetadata) {
|
||||
@@ -78,7 +79,7 @@ public class DropboxAttributesFinderFeature implements AttributesFinder, Attribu
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final Metadata metadata) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
if(metadata instanceof FileMetadata) {
|
||||
final FileMetadata file = (FileMetadata) metadata;
|
||||
attributes.setSize(file.getSize());
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ package ch.cyberduck.core.dropbox;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.ListService;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -67,7 +68,7 @@ public class DropboxSharedFoldersListService implements ListService {
|
||||
}
|
||||
|
||||
protected Path parse(final Path directory, final SharedFolderMetadata metadata) {
|
||||
final PathAttributes attr = new PathAttributes();
|
||||
final PathAttributes attr = new DefaultPathAttributes();
|
||||
return new Path(directory, PathNormalizer.name(metadata.getName()),
|
||||
EnumSet.of(Path.Type.directory, Path.Type.volume, Path.Type.shared), attr);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.dropbox;
|
||||
|
||||
import ch.cyberduck.core.AbstractDropboxTest;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -58,7 +59,7 @@ public class DropboxLockFeatureTest extends AbstractDropboxTest {
|
||||
@Test(expected = InteroperabilityException.class)
|
||||
public void testLock() throws Exception {
|
||||
final DropboxTouchFeature touch = new DropboxTouchFeature(session);
|
||||
final Path file = touch.touch(new DropboxWriteFeature(session), new Path(new Path(new DefaultHomeFinderService(session).find(), "Projects", EnumSet.of(Path.Type.directory, Path.Type.volume, Path.Type.shared)).withAttributes(new PathAttributes().setFileId("7581509952")),
|
||||
final Path file = touch.touch(new DropboxWriteFeature(session), new Path(new Path(new DefaultHomeFinderService(session).find(), "Projects", EnumSet.of(Path.Type.directory, Path.Type.volume, Path.Type.shared)).withAttributes(new DefaultPathAttributes().setFileId("7581509952")),
|
||||
new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
|
||||
final DropboxLockFeature f = new DropboxLockFeature(session);
|
||||
final String lock = f.lock(file);
|
||||
@@ -71,7 +72,7 @@ public class DropboxLockFeatureTest extends AbstractDropboxTest {
|
||||
@Ignore
|
||||
@Test(expected = NotfoundException.class)
|
||||
public void testLockNoSuchFile() throws Exception {
|
||||
final Path file = new Path(new Path(new DefaultHomeFinderService(session).find(), "Projects", EnumSet.of(Path.Type.directory, Path.Type.volume, Path.Type.shared)).withAttributes(new PathAttributes().setFileId("7581509952")),
|
||||
final Path file = new Path(new Path(new DefaultHomeFinderService(session).find(), "Projects", EnumSet.of(Path.Type.directory, Path.Type.volume, Path.Type.shared)).withAttributes(new DefaultPathAttributes().setFileId("7581509952")),
|
||||
new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
|
||||
final DropboxLockFeature f = new DropboxLockFeature(session);
|
||||
f.lock(file);
|
||||
@@ -80,7 +81,7 @@ public class DropboxLockFeatureTest extends AbstractDropboxTest {
|
||||
@Test
|
||||
public void testLockNotfound() throws Exception {
|
||||
final DropboxTouchFeature touch = new DropboxTouchFeature(session);
|
||||
final Path file = touch.touch(new DropboxWriteFeature(session), new Path(new Path(new DefaultHomeFinderService(session).find(), "Projects", EnumSet.of(Path.Type.directory, Path.Type.shared)).withAttributes(new PathAttributes().setFileId("7581509952")),
|
||||
final Path file = touch.touch(new DropboxWriteFeature(session), new Path(new Path(new DefaultHomeFinderService(session).find(), "Projects", EnumSet.of(Path.Type.directory, Path.Type.shared)).withAttributes(new DefaultPathAttributes().setFileId("7581509952")),
|
||||
new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
|
||||
final DropboxLockFeature f = new DropboxLockFeature(session);
|
||||
f.unlock(file, "l");
|
||||
|
||||
@@ -18,6 +18,7 @@ package ch.cyberduck.core.dropbox;
|
||||
import ch.cyberduck.core.AbstractDropboxTest;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
@@ -56,7 +57,7 @@ public class DropboxVersioningFeatureTest extends AbstractDropboxTest {
|
||||
assertEquals(test.attributes().getVersionId(), new DropboxAttributesFinderFeature(session).find(test).getVersionId());
|
||||
final DropboxVersioningFeature feature = new DropboxVersioningFeature(session);
|
||||
assertEquals(0, feature.list(test, new DisabledListProgressListener()).size());
|
||||
final PathAttributes initialAttributes = new PathAttributes(test.attributes());
|
||||
final PathAttributes initialAttributes = new DefaultPathAttributes(test.attributes());
|
||||
final String initialVersion = test.attributes().getVersionId();
|
||||
final byte[] content = RandomUtils.nextBytes(32769);
|
||||
final TransferStatus status = new TransferStatus();
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.eue;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -103,7 +104,7 @@ public class EueAttributesFinderFeature implements AttributesFinder {
|
||||
|
||||
protected PathAttributes toAttributes(final Uifs entity, final UiWin32 uiwin32,
|
||||
final ShareCreationResponseEntity share) {
|
||||
final PathAttributes attr = new PathAttributes();
|
||||
final PathAttributes attr = new DefaultPathAttributes();
|
||||
attr.setDisplayname(entity.getName());
|
||||
// Matches ETag response header
|
||||
attr.setETag(StringUtils.remove(entity.getMetaETag(), '"'));
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.eue;
|
||||
|
||||
import ch.cyberduck.core.AbstractPath;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -120,7 +121,7 @@ public class EueDeleteFeatureTest extends AbstractEueSessionTest {
|
||||
new EueDeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
try {
|
||||
new EueDeleteFeature(session, fileid).delete(Collections.singletonList(
|
||||
file.withAttributes(new PathAttributes().setFileId(resourceId))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
file.withAttributes(new DefaultPathAttributes().setFileId(resourceId))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
fail();
|
||||
}
|
||||
catch(NotfoundException e) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.eue;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DefaultPathPredicate;
|
||||
import ch.cyberduck.core.DescriptiveUrl;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
@@ -58,7 +59,7 @@ public class EueListServiceTest extends AbstractEueSessionTest {
|
||||
assertEquals(bucket.attributes(), new EueAttributesFinderFeature(session, fileid).find(bucket, new DisabledListProgressListener()));
|
||||
}
|
||||
assertNotNull(list.find(f -> f.attributes().getFileId().equals(EueResourceIdProvider.TRASH)));
|
||||
assertTrue(list.contains(new Path("Gelöschte Dateien", EnumSet.of(directory)).withAttributes(new PathAttributes().setFileId("TRASH"))));
|
||||
assertTrue(list.contains(new Path("Gelöschte Dateien", EnumSet.of(directory)).withAttributes(new DefaultPathAttributes().setFileId("TRASH"))));
|
||||
assertEquals(folder.attributes().getFileId(), list.find(new SimplePathPredicate(folder)).attributes().getFileId());
|
||||
assertSame(root, list.find(new SimplePathPredicate(folder)).getParent());
|
||||
new EueDeleteFeature(session, fileid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.eue;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -140,7 +141,7 @@ public class EueMoveFeatureTest extends AbstractEueSessionTest {
|
||||
final String resourceId = file.attributes().getFileId();
|
||||
new EueDeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
try {
|
||||
new EueMoveFeature(session, fileid).move(file.withAttributes(new PathAttributes().setFileId(resourceId)),
|
||||
new EueMoveFeature(session, fileid).move(file.withAttributes(new DefaultPathAttributes().setFileId(resourceId)),
|
||||
new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
|
||||
fail();
|
||||
}
|
||||
@@ -155,7 +156,7 @@ public class EueMoveFeatureTest extends AbstractEueSessionTest {
|
||||
final Path file = new EueTouchFeature(session, fileid).touch(new EueWriteFeature(session, fileid), new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
|
||||
final String resourceId = file.attributes().getFileId();
|
||||
new EueDeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
new EueMoveFeature(session, fileid).move(file.withAttributes(new PathAttributes().setFileId(resourceId)),
|
||||
new EueMoveFeature(session, fileid).move(file.withAttributes(new DefaultPathAttributes().setFileId(resourceId)),
|
||||
new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback());
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.eue;
|
||||
|
||||
import ch.cyberduck.core.AbstractPath;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -148,7 +149,7 @@ public class EueTrashFeatureTest extends AbstractEueSessionTest {
|
||||
try {
|
||||
// Skip file already in trash
|
||||
new EueTrashFeature(session, fileid).delete(Collections.singletonList(
|
||||
file.withAttributes(new PathAttributes().setFileId(resourceId))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
file.withAttributes(new DefaultPathAttributes().setFileId(resourceId))), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
}
|
||||
catch(NotfoundException e) {
|
||||
fail();
|
||||
|
||||
@@ -19,6 +19,7 @@ package ch.cyberduck.core.ftp;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.exception.BackgroundException;
|
||||
@@ -51,7 +52,7 @@ public class FTPMoveFeature implements Move {
|
||||
throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString());
|
||||
}
|
||||
// Copy original file attributes
|
||||
return new Path(renamed).withAttributes(new PathAttributes(file.attributes()).setVault(null));
|
||||
return new Path(renamed).withAttributes(new DefaultPathAttributes(file.attributes()).setVault(null));
|
||||
}
|
||||
catch(IOException e) {
|
||||
throw new FTPExceptionMappingService().map("Cannot rename {0}", e, file);
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ package ch.cyberduck.core.googledrive;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DefaultPathContainerService;
|
||||
import ch.cyberduck.core.DescriptiveUrl;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
@@ -99,7 +100,7 @@ public class DriveAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
return PathAttributes.EMPTY;
|
||||
}
|
||||
}
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setFileId(f.getId());
|
||||
if(null != f.getTrashed()) {
|
||||
if(f.getTrashed()) {
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.googledrive;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.SimplePathPredicate;
|
||||
@@ -51,7 +52,7 @@ public class DriveDirectoryFeature implements Directory<File> {
|
||||
final TeamDrive execute = session.getClient().teamdrives().create(
|
||||
new UUIDRandomStringService().random(), new TeamDrive().setName(folder.getName())
|
||||
).execute();
|
||||
return folder.withAttributes(new PathAttributes(folder.attributes()).setFileId(execute.getId()));
|
||||
return folder.withAttributes(new DefaultPathAttributes(folder.attributes()).setFileId(execute.getId()));
|
||||
}
|
||||
else {
|
||||
try {
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.googledrive;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -30,7 +31,7 @@ public class DriveHomeFinderService extends AbstractHomeFeature {
|
||||
|
||||
public static final Path MYDRIVE_FOLDER
|
||||
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("My Drive", "Google Drive")),
|
||||
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume), new PathAttributes().setFileId(ROOT_FOLDER_ID));
|
||||
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume), new DefaultPathAttributes().setFileId(ROOT_FOLDER_ID));
|
||||
|
||||
public static final Path SHARED_FOLDER_NAME
|
||||
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("Shared with me", "Google Drive")),
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ package ch.cyberduck.core.googledrive;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.ListService;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -60,7 +61,7 @@ public class DriveTeamDrivesListService implements ListService {
|
||||
.execute();
|
||||
for(TeamDrive f : list.getTeamDrives()) {
|
||||
final Path child = new Path(directory, f.getName(), EnumSet.of(Path.Type.directory, Path.Type.volume),
|
||||
new PathAttributes().setFileId(f.getId()));
|
||||
new DefaultPathAttributes().setFileId(f.getId()));
|
||||
children.add(child);
|
||||
}
|
||||
listener.chunk(directory, children);
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.googledrive;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.PasswordCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -107,7 +108,7 @@ public class DriveVersioningFeature implements Versioning {
|
||||
}
|
||||
|
||||
private PathAttributes toAttributes(final Revision f) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(f.getSize());
|
||||
if(f.getModifiedTime() != null) {
|
||||
attributes.setModificationDate(f.getModifiedTime().getValue());
|
||||
|
||||
+4
-3
@@ -16,6 +16,7 @@ package ch.cyberduck.core.googledrive;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -81,10 +82,10 @@ public class DefaultAttributesFinderFeatureTest extends AbstractDriveTest {
|
||||
final HttpResponseOutputStream<File> out = new DriveWriteFeature(session, fileid).write(file, status, new DisabledConnectionCallback());
|
||||
IOUtils.copy(new ByteArrayInputStream(content), out);
|
||||
out.close();
|
||||
assertEquals(initialFileid, f.find(file.withAttributes(new PathAttributes(file.attributes()).setFileId(initialFileid))).getFileId());
|
||||
assertEquals(initialFileid, f.find(file.withAttributes(new DefaultPathAttributes(file.attributes()).setFileId(initialFileid))).getFileId());
|
||||
final String newFileid = out.getStatus().getId();
|
||||
assertEquals(newFileid, f.find(file.withAttributes(new PathAttributes(file.attributes()).setFileId(newFileid))).getFileId());
|
||||
assertNotEquals(initialFileid, f.find(file.withAttributes(new PathAttributes(file.attributes()).setFileId(newFileid))).getFileId());
|
||||
assertEquals(newFileid, f.find(file.withAttributes(new DefaultPathAttributes(file.attributes()).setFileId(newFileid))).getFileId());
|
||||
assertNotEquals(initialFileid, f.find(file.withAttributes(new DefaultPathAttributes(file.attributes()).setFileId(newFileid))).getFileId());
|
||||
assertEquals(out.getStatus().getId(), f.find(file).getFileId());
|
||||
new DriveDeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
}
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@ package ch.cyberduck.core.googledrive;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.DisabledPasswordCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -52,8 +53,8 @@ public class DriveBatchTrashFeatureTest extends AbstractDriveTest {
|
||||
final String fileId = file.attributes().getFileId();
|
||||
new DriveBatchTrashFeature(session, fileid).delete(Collections.singletonList(file), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DriveFindFeature(session, fileid).find(file));
|
||||
assertTrue(new DriveFindFeature(session, fileid).find(file.withAttributes(new PathAttributes().setFileId(fileId))));
|
||||
final PathAttributes attributesInTrash = new DriveAttributesFinderFeature(session, fileid).find(file.withAttributes(new PathAttributes().setFileId(fileId)));
|
||||
assertTrue(new DriveFindFeature(session, fileid).find(file.withAttributes(new DefaultPathAttributes().setFileId(fileId))));
|
||||
final PathAttributes attributesInTrash = new DriveAttributesFinderFeature(session, fileid).find(file.withAttributes(new DefaultPathAttributes().setFileId(fileId)));
|
||||
assertTrue(attributesInTrash.isTrashed());
|
||||
new DriveBatchTrashFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(attributesInTrash)), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DriveFindFeature(session, fileid).find(file.withAttributes(attributesInTrash)));
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.googledrive;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
@@ -88,7 +89,7 @@ public class DriveMoveFeatureTest extends AbstractDriveTest {
|
||||
final AttributedList<Path> files = new DriveListService(session, fileid).list(folder, new DisabledListProgressListener());
|
||||
// Replaced file is trashed
|
||||
assertEquals(2, files.size());
|
||||
assertTrue(files.get(new Path(test).withAttributes(new PathAttributes().setFileId(firstVersion))).attributes().isTrashed());
|
||||
assertTrue(files.get(new Path(test).withAttributes(new DefaultPathAttributes().setFileId(firstVersion))).attributes().isTrashed());
|
||||
assertFalse(files.get(target).attributes().isHidden());
|
||||
assertTrue(find.find(target));
|
||||
new DriveDeleteFeature(session, fileid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.googledrive;
|
||||
|
||||
import ch.cyberduck.core.AbstractPath;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.DisabledPasswordCallback;
|
||||
@@ -67,8 +68,8 @@ public class DriveTrashFeatureTest extends AbstractDriveTest {
|
||||
final String fileId = file.attributes().getFileId();
|
||||
new DriveTrashFeature(session, fileid).delete(Collections.singletonList(file), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DriveFindFeature(session, fileid).find(file));
|
||||
assertTrue(new DriveFindFeature(session, fileid).find(file.withAttributes(new PathAttributes().setFileId(fileId))));
|
||||
final PathAttributes attributesInTrash = new DriveAttributesFinderFeature(session, fileid).find(file.withAttributes(new PathAttributes().setFileId(fileId)));
|
||||
assertTrue(new DriveFindFeature(session, fileid).find(file.withAttributes(new DefaultPathAttributes().setFileId(fileId))));
|
||||
final PathAttributes attributesInTrash = new DriveAttributesFinderFeature(session, fileid).find(file.withAttributes(new DefaultPathAttributes().setFileId(fileId)));
|
||||
assertTrue(attributesInTrash.isTrashed());
|
||||
new DriveTrashFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(attributesInTrash)), new DisabledPasswordCallback(), new Delete.DisabledCallback());
|
||||
assertFalse(new DriveFindFeature(session, fileid).find(file.withAttributes(attributesInTrash)));
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package ch.cyberduck.core.googledrive;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
@@ -56,7 +57,7 @@ public class DriveVersioningFeatureTest extends AbstractDriveTest {
|
||||
assertEquals(test.attributes().getVersionId(), attr.find(test).getVersionId());
|
||||
final DriveVersioningFeature feature = new DriveVersioningFeature(session, fileid);
|
||||
assertEquals(0, feature.list(test, new DisabledListProgressListener()).size());
|
||||
final PathAttributes initialAttributes = new PathAttributes(test.attributes());
|
||||
final PathAttributes initialAttributes = new DefaultPathAttributes(test.attributes());
|
||||
{
|
||||
final byte[] content = RandomUtils.nextBytes(32769);
|
||||
final TransferStatus status = new TransferStatus();
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@ package ch.cyberduck.core.googlestorage;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.CancellingListProgressListener;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -142,7 +143,7 @@ public class GoogleStorageAttributesFinderFeature implements AttributesFinder, A
|
||||
}
|
||||
|
||||
protected PathAttributes toAttributes(final Bucket bucket) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setRegion(bucket.getLocation());
|
||||
attributes.setStorageClass(bucket.getStorageClass());
|
||||
attributes.setCreationDate(bucket.getTimeCreated().getValue());
|
||||
@@ -159,7 +160,7 @@ public class GoogleStorageAttributesFinderFeature implements AttributesFinder, A
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final StorageObject object) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
if(object.getSize() != null) {
|
||||
attributes.setSize(object.getSize().longValue());
|
||||
}
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@ package ch.cyberduck.core.googlestorage;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.ListService;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -151,7 +152,7 @@ public class GoogleStorageObjectListService implements ListService {
|
||||
}
|
||||
else {
|
||||
final Path file;
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setRegion(bucket.attributes().getRegion());
|
||||
if(null == delimiter) {
|
||||
// When searching for files recursively
|
||||
@@ -206,7 +207,7 @@ public class GoogleStorageObjectListService implements ListService {
|
||||
return pool.execute(new BackgroundExceptionCallable<Path>() {
|
||||
@Override
|
||||
public Path call() throws BackgroundException {
|
||||
final PathAttributes attr = new PathAttributes();
|
||||
final PathAttributes attr = new DefaultPathAttributes();
|
||||
attr.setRegion(bucket.attributes().getRegion());
|
||||
final String key = StringUtils.removeEnd(prefix, String.valueOf(Path.DELIMITER));
|
||||
try {
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@ package ch.cyberduck.core.googlestorage;
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AsciiRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
@@ -80,13 +81,13 @@ public class GoogleStorageAttributesFinderFeatureTest extends AbstractGoogleStor
|
||||
new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out);
|
||||
out.close();
|
||||
final Path update = new Path(container, test.getName(), test.getType(),
|
||||
new PathAttributes().setVersionId(String.valueOf(out.getStatus().getGeneration())));
|
||||
new DefaultPathAttributes().setVersionId(String.valueOf(out.getStatus().getGeneration())));
|
||||
final PathAttributes attributes = new GoogleStorageAttributesFinderFeature(session).find(update);
|
||||
assertFalse(attributes.isDuplicate());
|
||||
final AttributedList<Path> versions = new GoogleStorageVersioningFeature(session).list(update, new DisabledListProgressListener());
|
||||
assertEquals(1, versions.size());
|
||||
assertFalse(versions.isEmpty());
|
||||
assertEquals(new Path(test).withAttributes(new PathAttributes(test.attributes()).setVersionId(versionId)), versions.get(0));
|
||||
assertEquals(new Path(test).withAttributes(new DefaultPathAttributes(test.attributes()).setVersionId(versionId)), versions.get(0));
|
||||
for(Path version : versions) {
|
||||
assertTrue(version.attributes().isDuplicate());
|
||||
}
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package ch.cyberduck.core.googlestorage;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.BytecountStreamListener;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledLoginCallback;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -180,7 +181,7 @@ public class GoogleStorageReadFeatureTest extends AbstractGoogleStorageTest {
|
||||
status.setChecksum(new SHA256ChecksumCompute().compute(new ByteArrayInputStream(content), status));
|
||||
final HttpResponseOutputStream<StorageObject> out = new GoogleStorageWriteFeature(session).write(file, status, new DisabledConnectionCallback());
|
||||
new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out);
|
||||
assertEquals(0L, new GoogleStorageAttributesFinderFeature(session).find(file.withAttributes(new PathAttributes(file.attributes()).setVersionId(initialVersion))).getSize());
|
||||
assertEquals(0L, new GoogleStorageAttributesFinderFeature(session).find(file.withAttributes(new DefaultPathAttributes(file.attributes()).setVersionId(initialVersion))).getSize());
|
||||
// Read previous version
|
||||
status.setLength(0L);
|
||||
final InputStream in = new GoogleStorageReadFeature(session).read(file, status, new DisabledConnectionCallback());
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.irods;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -57,7 +58,7 @@ public class IRODSAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final ObjStat stats) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setModificationDate(stats.getModifiedAt().getTime());
|
||||
attributes.setCreationDate(stats.getCreatedAt().getTime());
|
||||
attributes.setSize(stats.getObjSize());
|
||||
|
||||
@@ -18,6 +18,7 @@ package ch.cyberduck.core.irods;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.ListService;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -61,7 +62,7 @@ public class IRODSListService implements ListService {
|
||||
if(StringUtils.equals(normalized, directory.getAbsolute())) {
|
||||
continue;
|
||||
}
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
final ObjStat stats = fs.getObjStat(file.getAbsolutePath());
|
||||
attributes.setModificationDate(stats.getModifiedAt().getTime());
|
||||
attributes.setCreationDate(stats.getCreatedAt().getTime());
|
||||
|
||||
@@ -17,6 +17,7 @@ package ch.cyberduck.core.manta;
|
||||
|
||||
import ch.cyberduck.core.ConnectionCallback;
|
||||
import ch.cyberduck.core.DefaultIOExceptionMappingService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.LocaleFactory;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -48,7 +49,7 @@ public class MantaMoveFeature implements Move {
|
||||
try {
|
||||
session.getClient().move(file.getAbsolute(), renamed.getAbsolute());
|
||||
// Copy original file attributes
|
||||
return new Path(renamed).withAttributes(new PathAttributes(file.attributes()).setVault(null));
|
||||
return new Path(renamed).withAttributes(new DefaultPathAttributes(file.attributes()).setVault(null));
|
||||
}
|
||||
catch(MantaException e) {
|
||||
throw new MantaExceptionMappingService().map("Cannot rename {0}", e, file);
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.manta;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DefaultWebUrlProvider;
|
||||
import ch.cyberduck.core.DescriptiveUrl;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -41,7 +42,7 @@ public final class MantaObjectAttributeAdapter implements AttributesAdapter<Mant
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final MantaObject object) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setPermission(new Permission(
|
||||
session.isUserWritable(object) ? Permission.Action.all : Permission.Action.read,
|
||||
Permission.Action.none,
|
||||
|
||||
@@ -15,6 +15,7 @@ package ch.cyberduck.core.onedrive;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.onedrive.features.GraphFileIdProvider;
|
||||
@@ -34,7 +35,7 @@ public abstract class AbstractDriveListService extends AbstractListService<Drive
|
||||
|
||||
@Override
|
||||
protected Path toPath(final Drive.Metadata metadata, final Path directory) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setFileId(metadata.getId());
|
||||
final Quota quota = metadata.getQuota();
|
||||
if(quota != null) {
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.onedrive;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -59,10 +60,10 @@ public class SharepointListService extends AbstractSharepointListService {
|
||||
final Site site = Site.byId(session.getClient(), "root");
|
||||
final Site.Metadata metadata = site.getMetadata(null); // query: null: Default return set.
|
||||
final EnumSet<Path.Type> type = EnumSet.copyOf(DEFAULT_NAME.getType());
|
||||
final Path path = new Path(directory, DEFAULT_NAME.getName(), type, new PathAttributes().setFileId(metadata.getId()));
|
||||
final Path path = new Path(directory, DEFAULT_NAME.getName(), type, new DefaultPathAttributes().setFileId(metadata.getId()));
|
||||
path.setSymlinkTarget(
|
||||
new Path(SITES_NAME, metadata.getSiteCollection().getHostname(), SITES_NAME.getType(),
|
||||
new PathAttributes().setFileId(metadata.getId())));
|
||||
new DefaultPathAttributes().setFileId(metadata.getId())));
|
||||
return Optional.of(path);
|
||||
}
|
||||
catch(IOException ex) {
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ package ch.cyberduck.core.onedrive.features;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultIOExceptionMappingService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DescriptiveUrl;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -93,7 +94,7 @@ public class GraphAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final DriveItem.Metadata metadata) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setETag(metadata.getETag());
|
||||
final File file = metadata.getFile();
|
||||
if(file != null) {
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ package ch.cyberduck.core.onedrive.features.sharepoint;
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
import ch.cyberduck.core.onedrive.AbstractListService;
|
||||
@@ -50,7 +51,7 @@ public class GroupListService extends AbstractListService<GroupItem.Metadata> {
|
||||
|
||||
@Override
|
||||
protected Path toPath(final GroupItem.Metadata metadata, final Path directory) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setFileId(metadata.getId());
|
||||
return new Path(directory, metadata.getDisplayName(), EnumSet.of(Path.Type.volume, Path.Type.directory, Path.Type.placeholder), attributes);
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package ch.cyberduck.core.onedrive.features.sharepoint;
|
||||
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DescriptiveUrl;
|
||||
import ch.cyberduck.core.NullFilter;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -117,7 +118,7 @@ public class SitesListService extends AbstractListService<Site.Metadata> {
|
||||
|
||||
@Override
|
||||
protected Path toPath(final Site.Metadata metadata, final Path directory) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setFileId(metadata.getId());
|
||||
attributes.setDisplayname(metadata.getDisplayName());
|
||||
attributes.setLink(new DescriptiveUrl(metadata.getWebUrl()));
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package ch.cyberduck.core.onedrive;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledPasswordCallback;
|
||||
@@ -72,7 +73,7 @@ public class OneDriveVersioningFeatureTest extends AbstractOneDriveTest {
|
||||
}
|
||||
assertEquals(test.attributes().getFileId(), new GraphAttributesFinderFeature(session, fileid).find(test).getFileId());
|
||||
assertEquals(0, feature.list(test, new DisabledListProgressListener()).size());
|
||||
final PathAttributes initialAttributes = new PathAttributes(test.attributes());
|
||||
final PathAttributes initialAttributes = new DefaultPathAttributes(test.attributes());
|
||||
final byte[] content = RandomUtils.nextBytes(32769);
|
||||
final TransferStatus status = new TransferStatus();
|
||||
status.setLength(content.length);
|
||||
|
||||
@@ -16,6 +16,7 @@ package ch.cyberduck.core.onedrive;
|
||||
*/
|
||||
|
||||
import ch.cyberduck.core.AbstractPath;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.Host;
|
||||
import ch.cyberduck.core.Path;
|
||||
import ch.cyberduck.core.PathAttributes;
|
||||
@@ -77,7 +78,7 @@ public class SharepointSessionTest {
|
||||
@Test
|
||||
public void testContainerEquality() {
|
||||
final Path source = new Path("/Default/Drives/Docs", EnumSet.of(Path.Type.directory))
|
||||
.withAttributes(new PathAttributes()
|
||||
.withAttributes(new DefaultPathAttributes()
|
||||
.setFileId("File Id"));
|
||||
final Path target = new Path("/Default/Drives/Docs", EnumSet.of(Path.Type.directory));
|
||||
final GraphSession.ContainerItem sourceItem = session.getContainer(source);
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package ch.cyberduck.core.onedrive;
|
||||
|
||||
import ch.cyberduck.core.AlphanumericRandomStringService;
|
||||
import ch.cyberduck.core.AttributedList;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DisabledConnectionCallback;
|
||||
import ch.cyberduck.core.DisabledListProgressListener;
|
||||
import ch.cyberduck.core.DisabledPasswordCallback;
|
||||
@@ -74,7 +75,7 @@ public class SharepointVersioningFeatureTest extends AbstractSharepointTest {
|
||||
}
|
||||
assertEquals(test.attributes().getFileId(), new GraphAttributesFinderFeature(session, fileid).find(test).getFileId());
|
||||
assertEquals(0, feature.list(test, new DisabledListProgressListener()).size());
|
||||
final PathAttributes initialAttributes = new PathAttributes(test.attributes());
|
||||
final PathAttributes initialAttributes = new DefaultPathAttributes(test.attributes());
|
||||
assertNotNull(initialAttributes.getVersionId());
|
||||
final byte[] content = RandomUtils.nextBytes(32769);
|
||||
final TransferStatus status = new TransferStatus();
|
||||
|
||||
+5
-4
@@ -20,6 +20,7 @@ package ch.cyberduck.core.openstack;
|
||||
|
||||
import ch.cyberduck.core.CancellingListProgressListener;
|
||||
import ch.cyberduck.core.DefaultIOExceptionMappingService;
|
||||
import ch.cyberduck.core.DefaultPathAttributes;
|
||||
import ch.cyberduck.core.DefaultPathContainerService;
|
||||
import ch.cyberduck.core.ListProgressListener;
|
||||
import ch.cyberduck.core.Path;
|
||||
@@ -78,7 +79,7 @@ public class SwiftAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
if(containerService.isContainer(file)) {
|
||||
final ContainerInfo info = session.getClient().getContainerInfo(region,
|
||||
containerService.getContainer(file).getName());
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(info.getTotalSize());
|
||||
attributes.setRegion(info.getRegion().getRegionId());
|
||||
return attributes;
|
||||
@@ -112,7 +113,7 @@ public class SwiftAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
// Try to find pending large file upload
|
||||
final Write.Append append = new SwiftLargeObjectUploadFeature(session, regionService).append(file, new TransferStatus());
|
||||
if(append.append) {
|
||||
return new PathAttributes().setSize(append.offset);
|
||||
return new DefaultPathAttributes().setSize(append.offset);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
@@ -140,7 +141,7 @@ public class SwiftAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
|
||||
@Override
|
||||
public PathAttributes toAttributes(final StorageObject object) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
if(StringUtils.isNotBlank(object.getMd5sum())) {
|
||||
// For manifest files, the ETag in the response for a GET or HEAD on the manifest file is the MD5 sum of
|
||||
// the concatenated string of ETags for each of the segments in the manifest.
|
||||
@@ -166,7 +167,7 @@ public class SwiftAttributesFinderFeature implements AttributesFinder, Attribute
|
||||
}
|
||||
|
||||
public PathAttributes toAttributes(final ObjectMetadata metadata) {
|
||||
final PathAttributes attributes = new PathAttributes();
|
||||
final PathAttributes attributes = new DefaultPathAttributes();
|
||||
attributes.setSize(Long.parseLong(metadata.getContentLength()));
|
||||
final String lastModified = metadata.getLastModified();
|
||||
try {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user