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

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

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

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

@Override
public void update(MailboxSession session, Mailbox mailbox, List<UpdatedFlags> updatedFlagsList) throws MailboxException {
  try {
    elasticSearchIndexer.update(updatedFlagsList.stream()
      .map(updatedFlags -> createUpdatedDocumentPartFromUpdatedFlags(mailbox, updatedFlags))
      .collect(Collectors.toList()));
  } catch (Exception e) {
    LOGGER.error("Error when updating index on mailbox {}", mailbox.getMailboxId().serialize(), e);
  }
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Test
public void updateShouldWork() throws Exception {
  //Given
  Mailbox mailbox = mock(Mailbox.class);
  Flags flags = new Flags();
  UpdatedFlags updatedFlags = UpdatedFlags.builder()
    .uid(MESSAGE_UID)
    .modSeq(MODSEQ)
    .oldFlags(flags)
    .newFlags(flags)
    .build();
  when(mailbox.getMailboxId())
    .thenReturn(MAILBOX_ID);
  when(messageToElasticSearchJson.getUpdatedJsonMessagePart(any(Flags.class), any(Long.class)))
    .thenReturn("json updated content");
  
  //When
  testee.update(session, mailbox, Lists.newArrayList(updatedFlags));
  
  //Then
  ImmutableList<UpdatedRepresentation> expectedUpdatedRepresentations = ImmutableList.of(new UpdatedRepresentation(ELASTIC_SEARCH_ID, "json updated content"));
  verify(elasticSearchIndexer).update(expectedUpdatedRepresentations);
}
origin: org.apache.james/apache-james-mailbox-elasticsearch

@Test
public void updateShouldNotPropagateExceptionWhenExceptionOccurs() throws Exception {
  //Given
  Mailbox mailbox = mock(Mailbox.class);
  Flags flags = new Flags();
  UpdatedFlags updatedFlags = UpdatedFlags.builder()
    .uid(MESSAGE_UID)
    .modSeq(MODSEQ)
    .oldFlags(flags)
    .newFlags(flags)
    .build();
  when(mailbox.getMailboxId())
    .thenReturn(MAILBOX_ID);
  ImmutableList<UpdatedRepresentation> expectedUpdatedRepresentations = ImmutableList.of(new UpdatedRepresentation(ELASTIC_SEARCH_ID, "json updated content"));
  when(elasticSearchIndexer.update(expectedUpdatedRepresentations))
    .thenThrow(new ElasticsearchException(""));
  
  //When
  testee.update(session, mailbox, Lists.newArrayList(updatedFlags));
  
  //Then
  //No exception
}
org.apache.james.backends.esElasticSearchIndexerupdate

Popular methods of ElasticSearchIndexer

  • index
  • <init>
  • delete
  • deleteAllMatchingQuery
  • checkArgument

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Best IntelliJ 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