@Test(expected = NotfoundException.class) public void testDeleteNotFoundKey() throws Exception { final Host host = new Host(new AzureProtocol(), "kahy9boj3eib.blob.core.windows.net", new Credentials( System.getProperties().getProperty("azure.account"), System.getProperties().getProperty("azure.key") )); final AzureSession session = new AzureSession(host); new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener()).connect(session, PathCache.empty(), new DisabledCancelCallback()); final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new AzureDeleteFeature(session, null).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { final List<Path> containers = new ArrayList<Path>(); for(Path file : files.keySet()) { if(containerService.isContainer(file)) { containers.add(file); } else { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()) .getBlockBlobReference(containerService.getKey(file)).delete( DeleteSnapshotsOption.INCLUDE_SNAPSHOTS, AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } for(Path file : containers) { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()).delete( AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } }
AzureDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { final List<Path> containers = new ArrayList<Path>(); for(Path file : files.keySet()) { if(containerService.isContainer(file)) { containers.add(file); } else { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()) .getBlockBlobReference(containerService.getKey(file)).delete( DeleteSnapshotsOption.INCLUDE_SNAPSHOTS, AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } for(Path file : containers) { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()).delete( AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } }
AzureDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { final List<Path> containers = new ArrayList<Path>(); for(Path file : files.keySet()) { if(containerService.isContainer(file)) { containers.add(file); } else { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()) .getBlockBlobReference(containerService.getKey(file)).delete( DeleteSnapshotsOption.INCLUDE_SNAPSHOTS, AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } for(Path file : containers) { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()).delete( AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } AzureDeleteFeature(final AzureSession session, final OperationContext context); }
AzureDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { final List<Path> containers = new ArrayList<Path>(); for(Path file : files.keySet()) { if(containerService.isContainer(file)) { containers.add(file); } else { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()) .getBlockBlobReference(containerService.getKey(file)).delete( DeleteSnapshotsOption.INCLUDE_SNAPSHOTS, AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } for(Path file : containers) { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()).delete( AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } AzureDeleteFeature(final AzureSession session, final OperationContext context); @Override void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback); }
AzureDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { final List<Path> containers = new ArrayList<Path>(); for(Path file : files.keySet()) { if(containerService.isContainer(file)) { containers.add(file); } else { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()) .getBlockBlobReference(containerService.getKey(file)).delete( DeleteSnapshotsOption.INCLUDE_SNAPSHOTS, AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } for(Path file : containers) { callback.delete(file); try { final BlobRequestOptions options = new BlobRequestOptions(); session.getClient().getContainerReference(containerService.getContainer(file).getName()).delete( AccessCondition.generateEmptyCondition(), options, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Cannot delete {0}", e, file); } catch(URISyntaxException e) { throw new NotfoundException(e.getMessage(), e); } } } AzureDeleteFeature(final AzureSession session, final OperationContext context); @Override void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback);  }