@Test public void testDeleteContainer() throws Exception { final Path container = new Path(UUID.randomUUID().toString(), EnumSet.of(Path.Type.volume, Path.Type.directory)); container.attributes().setRegion("US"); new GoogleStorageDirectoryFeature(session).mkdir(container, null, new TransferStatus()); assertTrue(new GoogleStorageFindFeature(session).find(container)); new GoogleStorageDeleteFeature(session).delete(Collections.singletonList(container), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(new GoogleStorageFindFeature(session).find(container)); }
@Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { try { for(Path file : files.keySet()) { callback.delete(file); if(containerService.isContainer(file)) { session.getClient().buckets().delete(file.getName()).execute(); } else { session.getClient().objects().delete(containerService.getContainer(file).getName(), containerService.getKey(file)).execute(); } } } catch(IOException e) { throw new GoogleStorageExceptionMappingService().map(e); } }
GoogleStorageDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { try { for(Path file : files.keySet()) { callback.delete(file); if(containerService.isContainer(file)) { session.getClient().buckets().delete(file.getName()).execute(); } else { session.getClient().objects().delete(containerService.getContainer(file).getName(), containerService.getKey(file)).execute(); } } } catch(IOException e) { throw new GoogleStorageExceptionMappingService().map(e); } } }
GoogleStorageDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { try { for(Path file : files.keySet()) { callback.delete(file); if(containerService.isContainer(file)) { session.getClient().buckets().delete(file.getName()).execute(); } else { session.getClient().objects().delete(containerService.getContainer(file).getName(), containerService.getKey(file)).execute(); } } } catch(IOException e) { throw new GoogleStorageExceptionMappingService().map(e); } } GoogleStorageDeleteFeature(final GoogleStorageSession session); }
GoogleStorageDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { try { for(Path file : files.keySet()) { callback.delete(file); if(containerService.isContainer(file)) { session.getClient().buckets().delete(file.getName()).execute(); } else { session.getClient().objects().delete(containerService.getContainer(file).getName(), containerService.getKey(file)).execute(); } } } catch(IOException e) { throw new GoogleStorageExceptionMappingService().map(e); } } GoogleStorageDeleteFeature(final GoogleStorageSession session); @Override void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback); @Override boolean isSupported(final Path file); }
GoogleStorageDeleteFeature implements Delete { @Override public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { try { for(Path file : files.keySet()) { callback.delete(file); if(containerService.isContainer(file)) { session.getClient().buckets().delete(file.getName()).execute(); } else { session.getClient().objects().delete(containerService.getContainer(file).getName(), containerService.getKey(file)).execute(); } } } catch(IOException e) { throw new GoogleStorageExceptionMappingService().map(e); } } GoogleStorageDeleteFeature(final GoogleStorageSession session); @Override void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback); @Override boolean isSupported(final Path file);  }