AsyncRateLimitedTable implements AsyncReadWriteTable<K, V> { @Override public CompletableFuture<Void> deleteAllAsync(List<K> keys, Object ... args) { return doWrite( () -> writeRateLimiter.throttle(keys, args), () -> table.deleteAllAsync(keys, args)); } AsyncRateLimitedTable(String tableId, AsyncReadWriteTable<K, V> table, TableRateLimiter<K, V> readRateLimiter,
      TableRateLimiter<K, V> writeRateLimiter, ExecutorService rateLimitingExecutor); @Override CompletableFuture<V> getAsync(K key, Object ... args); @Override CompletableFuture<Map<K, V>> getAllAsync(List<K> keys, Object ... args); @Override CompletableFuture<T> readAsync(int opId, Object ... args); @Override CompletableFuture<Void> putAsync(K key, V value, Object ... args); @Override CompletableFuture<Void> putAllAsync(List<Entry<K, V>> entries, Object ... args); @Override CompletableFuture<Void> deleteAsync(K key, Object ... args); @Override CompletableFuture<Void> deleteAllAsync(List<K> keys, Object ... args); @Override CompletableFuture<T> writeAsync(int opId, Object ... args); @Override void init(Context context); @Override void flush(); @Override void close();  }
@Test public void testDeleteAllAsync() { writeTable.deleteAllAsync(Arrays.asList("1", "2")).join(); verify(writeFn, times(1)).deleteAllAsync(anyCollection()); verify(writeFn, times(0)).deleteAllAsync(anyCollection(), any()); verify(writeRateLimiter, times(0)).throttle(anyString()); verify(writeRateLimiter, times(0)).throttle(anyString(), anyString()); verify(writeRateLimiter, times(1)).throttle(anyCollection()); verify(writeRateLimiter, times(0)).throttleRecords(anyCollection()); verify(writeRateLimiter, times(0)).throttle(anyInt(), any()); verifyReadPartNotCalled(); }
@Test public void testDeleteAllAsyncWithArgs() { writeTable.deleteAllAsync(Arrays.asList("1", "2"), 1).join(); verify(writeFn, times(0)).deleteAllAsync(anyCollection()); verify(writeFn, times(1)).deleteAllAsync(anyCollection(), any()); verify(writeRateLimiter, times(0)).throttle(anyString()); verify(writeRateLimiter, times(0)).throttle(anyString(), anyString()); verify(writeRateLimiter, times(1)).throttle(anyCollection(), any()); verify(writeRateLimiter, times(0)).throttleRecords(anyCollection()); verify(writeRateLimiter, times(0)).throttle(anyInt(), any()); verifyReadPartNotCalled(); }