Tabnine Logo
ElasticSearchIndexer.delete
Code IndexAdd Tabnine to your IDE (free)

How to use
delete
method
in
org.apache.james.backends.es.ElasticSearchIndexer

Best Java code snippets using org.apache.james.backends.es.ElasticSearchIndexer.delete (Showing top 4 results out of 315)

origin: org.apache.james/apache-james-mailbox-elasticsearch

@Override
public void delete(MailboxSession session, Mailbox mailbox, List<MessageUid> expungedUids) throws MailboxException {
  try {
    elasticSearchIndexer.delete(expungedUids.stream()
      .map(uid ->  indexIdFor(mailbox, uid))
      .collect(Collectors.toList()));
  } catch (Exception e) {
    if (LOGGER.isErrorEnabled()) {
      LOGGER.error("Error when deleting messages {} in mailbox {} from index", mailbox.getMailboxId().serialize(), expungedUids.toArray(), e);
    }
  }
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Test
@SuppressWarnings("unchecked")
public void deleteShouldWork() throws Exception {
  //Given
  Mailbox mailbox = mock(Mailbox.class);
  when(mailbox.getMailboxId())
    .thenReturn(MAILBOX_ID);
  BulkResponse expectedBulkResponse = mock(BulkResponse.class);
  when(elasticSearchIndexer.delete(any(List.class)))
    .thenReturn(Optional.of(expectedBulkResponse));
  //When
  testee.delete(session, mailbox, Lists.newArrayList(MESSAGE_UID));
  //Then
  verify(elasticSearchIndexer).delete(eq(Lists.newArrayList(ELASTIC_SEARCH_ID)));
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Test
@SuppressWarnings("unchecked")
public void deleteShouldNotPropagateExceptionWhenExceptionOccurs() throws Exception {
  //Given
  Mailbox mailbox = mock(Mailbox.class);
  when(mailbox.getMailboxId())
    .thenReturn(MAILBOX_ID);
  
  when(elasticSearchIndexer.delete(any(List.class)))
    .thenThrow(new ElasticsearchException(""));
  
  //When
  testee.delete(session, mailbox, Lists.newArrayList(MESSAGE_UID));
  
  //Then
  //No exception
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Test
@SuppressWarnings("unchecked")
public void deleteShouldWorkWhenMultipleMessageIds() throws Exception {
  //Given
  Mailbox mailbox = mock(Mailbox.class);
  MessageUid messageId2 = MessageUid.of(2);
  MessageUid messageId3 = MessageUid.of(3);
  MessageUid messageId4 = MessageUid.of(4);
  MessageUid messageId5 = MessageUid.of(5);
  when(mailbox.getMailboxId())
    .thenReturn(MAILBOX_ID);
  BulkResponse expectedBulkResponse = mock(BulkResponse.class);
  when(elasticSearchIndexer.delete(any(List.class)))
    .thenReturn(Optional.of(expectedBulkResponse));
  
  //When
  testee.delete(session, mailbox, Lists.newArrayList(MESSAGE_UID, messageId2, messageId3, messageId4, messageId5));
  
  //Then
  verify(elasticSearchIndexer).delete(eq(Lists.newArrayList(ELASTIC_SEARCH_ID, "12:2", "12:3", "12:4", "12:5")));
}
org.apache.james.backends.esElasticSearchIndexerdelete

Popular methods of ElasticSearchIndexer

  • index
  • <init>
  • deleteAllMatchingQuery
  • update
  • checkArgument

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JFrame (javax.swing)
  • JTextField (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now