public void execute(String containerName) { execute(containerName, recursive()); }
public void execute(String containerName) { execute(containerName, recursive()); }
public void execute(String containerName) { execute(containerName, recursive()); }
public void execute(String containerName) { execute(containerName, recursive()); }
public void execute(String containerName) { execute(containerName, recursive()); }
public void execute(String containerName) { execute(containerName, recursive()); }
public void execute(String containerName) { execute(containerName, recursive()); }
public void testExecuteNonRecursive() { deleter.execute(containerName, ListContainerOptions.NONE); assertEquals(blobstore.countBlobs(containerName), 2222); }
public void testExecuteWithoutOptionsClearsRecursively() { deleter.execute(containerName); assertEquals(blobstore.countBlobs(containerName), 0); }
public void testExecuteWithoutOptionsClearsRecursively() { deleter.execute(containerName); assertEquals(blobstore.countBlobs(containerName), 0); }
public void testExecuteNonRecursive() { deleter.execute(containerName, ListContainerOptions.NONE); assertEquals(blobstore.countBlobs(containerName), 2222); }
public void testExecuteInDirectory() { deleter.execute(containerName, ListContainerOptions.Builder.inDirectory(directoryName)); assertEquals(blobstore.countBlobs(containerName), 1111); }
public void testExecuteRecursive() { deleter.execute(containerName, ListContainerOptions.Builder.recursive()); assertEquals(blobstore.countBlobs(containerName), 0); }
public void testExecuteRecursive() { deleter.execute(containerName, ListContainerOptions.Builder.recursive()); assertEquals(blobstore.countBlobs(containerName), 0); }
public void testExecuteInDirectory() { deleter.execute(containerName, ListContainerOptions.Builder.inDirectory(directoryName)); assertEquals(blobstore.countBlobs(containerName), 1111); }
public void testListTimeoutException() throws Exception { ListenableFuture<PageSet<? extends StorageMetadata>> future = createMock(ListenableFuture.class); expect(future.get(anyLong(), anyObject(TimeUnit.class))).andThrow(new RuntimeException(new TimeoutException())); expect(future.cancel(true)).andReturn(true); replay(future); AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class); expect(asyncBlobStore.list(anyObject(String.class), anyObject(ListContainerOptions.class))).andReturn(future); replay(asyncBlobStore); deleter = new DeleteAllKeysInList(null, asyncBlobStore, null); try { deleter.execute(containerName, ListContainerOptions.NONE); fail(); } catch (Exception e) { if (Throwables2.getFirstThrowableOfType(e, TimeoutException.class) == null) { throw e; } } }
case RELATIVE_PATH: if (options.isRecursive() && !fullPath.equals(options.getDir())) { execute(containerName, options.clone().inDirectory(fullPath));
@SuppressWarnings("unchecked") public void testDeleteAfterFutureFailure() { IMocksControl mockControl = createControl(); ListeningExecutorService executorService = mockControl .createMock(ListeningExecutorService.class); DeleteAllKeysInList testDeleter = createMockBuilder( DeleteAllKeysInList.class).withConstructor(executorService, blobstore, retryHandler, maxParallelDeletes).createMock(); // Fail the first future that is created for deleting blobs. EasyMock.<ListenableFuture<?>> expect( executorService.submit(isA(Callable.class))) .andReturn( Futures.<Void> immediateFailedFuture(new RuntimeException())) .once(); // There should be at least another 3333 calls to executorService.submit // since there are 3333 blobs. EasyMock.expectLastCall().andReturn(Futures.<Void> immediateFuture(null)) .times(3333, Integer.MAX_VALUE); replay(executorService); testDeleter.execute(containerName, ListContainerOptions.Builder.recursive()); }
@SuppressWarnings("unchecked") public void testExceptionThrownAfterMaxRetries() { IMocksControl mockControl = createControl(); ListeningExecutorService executorService = mockControl .createMock(ListeningExecutorService.class); DeleteAllKeysInList testDeleter = createMockBuilder( DeleteAllKeysInList.class).withConstructor(executorService, blobstore, retryHandler, maxParallelDeletes).createMock(); // Fail the first future that is created for deleting blobs. EasyMock.<ListenableFuture<?>> expect( executorService.submit(isA(Callable.class))) .andReturn( Futures.<Void> immediateFailedFuture(new RuntimeException())) .once(); EasyMock.expectLastCall().andReturn(Futures.<Void> immediateFuture(null)) .anyTimes(); replay(executorService); testDeleter.setMaxErrors(1); boolean blobRunTimeExceptionThrown = false; try { testDeleter.execute(containerName, ListContainerOptions.Builder.recursive()); } catch (BlobRuntimeException be) { blobRunTimeExceptionThrown = true; } assertTrue(blobRunTimeExceptionThrown, "Expected a BlobRunTimeException"); }
public void testContainerNotFound() { IMocksControl mockControl = createControl(); BlobStore blobStore = mockControl.createMock(BlobStore.class); ListeningExecutorService executorService = mockControl .createMock(ListeningExecutorService.class); DeleteAllKeysInList testDeleter = createMockBuilder( DeleteAllKeysInList.class).withConstructor(executorService, blobStore, retryHandler, maxParallelDeletes).createMock(); EasyMock.<PageSet<? extends StorageMetadata>> expect(blobStore.list( isA(String.class), isA(ListContainerOptions.class))) .andThrow(new ContainerNotFoundException()).once(); replay(blobStore); testDeleter.execute(containerName, ListContainerOptions.Builder.recursive()); // No blobs will be deleted since blobStore.list will throw a // ContainerNotFoundException. assertEquals(blobstore.countBlobs(containerName), 3333); }