@Test public void shouldDeleteEntries() throws ErrorResultException { Collection<Entry> entries = Arrays.asList( generateEntry("one"),generateEntry("two"),generateEntry("three")); deletion.deleteBatch(entries, mock(ResultHandler.class)); verify(mockAdapter, times(3)).deleteAsync( eq(mockConnection), anyString(), any(ResultHandler.class)); }
public void deleteBatch(Collection<Entry> entries, ResultHandler<Result> resultHandler) throws ErrorResultException { for (Entry entry : entries) { String tokenId = entry.getAttribute(CoreTokenField.TOKEN_ID.toString()).firstValueAsString(); adapter.deleteAsync(getConnection(), tokenId, resultHandler); } }
TokenDeletion implements Closeable { public void deleteBatch(Collection<Entry> entries, ResultHandler<Result> resultHandler) throws ErrorResultException { for (Entry entry : entries) { String tokenId = entry.getAttribute(CoreTokenField.TOKEN_ID.toString()).firstValueAsString(); adapter.deleteAsync(getConnection(), tokenId, resultHandler); } } }
TokenDeletion implements Closeable { public void deleteBatch(Collection<Entry> entries, ResultHandler<Result> resultHandler) throws ErrorResultException { for (Entry entry : entries) { String tokenId = entry.getAttribute(CoreTokenField.TOKEN_ID.toString()).firstValueAsString(); adapter.deleteAsync(getConnection(), tokenId, resultHandler); } } @Inject  TokenDeletion(LDAPAdapter adapter, ConnectionFactory factory); }
TokenDeletion implements Closeable { public void deleteBatch(Collection<Entry> entries, ResultHandler<Result> resultHandler) throws ErrorResultException { for (Entry entry : entries) { String tokenId = entry.getAttribute(CoreTokenField.TOKEN_ID.toString()).firstValueAsString(); adapter.deleteAsync(getConnection(), tokenId, resultHandler); } } @Inject  TokenDeletion(LDAPAdapter adapter, ConnectionFactory factory); void deleteBatch(Collection<Entry> entries, ResultHandler<Result> resultHandler); void close(); }
TokenDeletion implements Closeable { public void deleteBatch(Collection<Entry> entries, ResultHandler<Result> resultHandler) throws ErrorResultException { for (Entry entry : entries) { String tokenId = entry.getAttribute(CoreTokenField.TOKEN_ID.toString()).firstValueAsString(); adapter.deleteAsync(getConnection(), tokenId, resultHandler); } } @Inject  TokenDeletion(LDAPAdapter adapter, ConnectionFactory factory); void deleteBatch(Collection<Entry> entries, ResultHandler<Result> resultHandler); void close();  }