Search in sources :

Example 16 with AddUpdateCommand

use of org.apache.solr.update.AddUpdateCommand in project lucene-solr by apache.

the class SkipExistingDocumentsProcessorFactoryTest method testNonSkippableInsertIsNotSkippedIfSkipInsertsTrue.

@Test
public void testNonSkippableInsertIsNotSkippedIfSkipInsertsTrue() throws IOException {
    UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
    SkipExistingDocumentsUpdateProcessor processor = Mockito.spy(new SkipExistingDocumentsUpdateProcessor(defaultRequest, next, true, false));
    AddUpdateCommand cmd = createInsertUpdateCmd(defaultRequest);
    doReturn(true).when(processor).isLeader(cmd);
    doReturn(false).when(processor).doesDocumentExist(docId);
    processor.processAdd(cmd);
    verify(next).processAdd(cmd);
}
Also used : AddUpdateCommand(org.apache.solr.update.AddUpdateCommand) SkipExistingDocumentsUpdateProcessor(org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor) Test(org.junit.Test)

Example 17 with AddUpdateCommand

use of org.apache.solr.update.AddUpdateCommand in project lucene-solr by apache.

the class SkipExistingDocumentsProcessorFactoryTest method testSkippableInsertIsSkippedIfSkipInsertsTrue.

@Test
public void testSkippableInsertIsSkippedIfSkipInsertsTrue() throws IOException {
    UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
    SkipExistingDocumentsUpdateProcessor processor = Mockito.spy(new SkipExistingDocumentsUpdateProcessor(defaultRequest, next, true, false));
    AddUpdateCommand cmd = createInsertUpdateCmd(defaultRequest);
    doReturn(true).when(processor).isLeader(cmd);
    doReturn(true).when(processor).doesDocumentExist(docId);
    processor.processAdd(cmd);
    verify(next, never()).processAdd(cmd);
}
Also used : AddUpdateCommand(org.apache.solr.update.AddUpdateCommand) SkipExistingDocumentsUpdateProcessor(org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor) Test(org.junit.Test)

Example 18 with AddUpdateCommand

use of org.apache.solr.update.AddUpdateCommand in project lucene-solr by apache.

the class SkipExistingDocumentsProcessorFactoryTest method testSkippableUpdateIsNotSkippedIfNotLeader.

@Test
public void testSkippableUpdateIsNotSkippedIfNotLeader() throws IOException {
    UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
    SkipExistingDocumentsUpdateProcessor processor = Mockito.spy(new SkipExistingDocumentsUpdateProcessor(defaultRequest, next, true, true));
    AddUpdateCommand cmd = createAtomicUpdateCmd(defaultRequest);
    doReturn(false).when(processor).isLeader(cmd);
    doReturn(false).when(processor).doesDocumentExist(docId);
    processor.processAdd(cmd);
    verify(next).processAdd(cmd);
}
Also used : AddUpdateCommand(org.apache.solr.update.AddUpdateCommand) SkipExistingDocumentsUpdateProcessor(org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor) Test(org.junit.Test)

Example 19 with AddUpdateCommand

use of org.apache.solr.update.AddUpdateCommand in project lucene-solr by apache.

the class SkipExistingDocumentsProcessorFactoryTest method testSkippableUpdateIsNotSkippedIfSkipUpdatesFalse.

@Test
public void testSkippableUpdateIsNotSkippedIfSkipUpdatesFalse() throws IOException {
    UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
    SkipExistingDocumentsUpdateProcessor processor = Mockito.spy(new SkipExistingDocumentsUpdateProcessor(defaultRequest, next, false, false));
    AddUpdateCommand cmd = createAtomicUpdateCmd(defaultRequest);
    doReturn(true).when(processor).isLeader(cmd);
    doReturn(false).when(processor).doesDocumentExist(docId);
    processor.processAdd(cmd);
    verify(next).processAdd(cmd);
}
Also used : AddUpdateCommand(org.apache.solr.update.AddUpdateCommand) SkipExistingDocumentsUpdateProcessor(org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor) Test(org.junit.Test)

Example 20 with AddUpdateCommand

use of org.apache.solr.update.AddUpdateCommand in project lucene-solr by apache.

the class SkipExistingDocumentsProcessorFactoryTest method testSkippableInsertIsNotSkippedIfNotLeader.

// Tests for logic in the processor
@Test
public void testSkippableInsertIsNotSkippedIfNotLeader() throws IOException {
    UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
    SkipExistingDocumentsUpdateProcessor processor = Mockito.spy(new SkipExistingDocumentsUpdateProcessor(defaultRequest, next, true, true));
    AddUpdateCommand cmd = createInsertUpdateCmd(defaultRequest);
    doReturn(false).when(processor).isLeader(cmd);
    doReturn(true).when(processor).doesDocumentExist(docId);
    processor.processAdd(cmd);
    verify(next).processAdd(cmd);
}
Also used : AddUpdateCommand(org.apache.solr.update.AddUpdateCommand) SkipExistingDocumentsUpdateProcessor(org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor) Test(org.junit.Test)

Aggregations

AddUpdateCommand (org.apache.solr.update.AddUpdateCommand)68 SolrInputDocument (org.apache.solr.common.SolrInputDocument)41 Test (org.junit.Test)34 SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)31 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)26 BufferingRequestProcessor (org.apache.solr.update.processor.BufferingRequestProcessor)19 ContentStreamBase (org.apache.solr.common.util.ContentStreamBase)17 SolrInputField (org.apache.solr.common.SolrInputField)14 LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)12 JsonLoader (org.apache.solr.handler.loader.JsonLoader)11 ArrayList (java.util.ArrayList)10 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)10 SkipExistingDocumentsUpdateProcessor (org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor)8 SolrException (org.apache.solr.common.SolrException)7 DeleteUpdateCommand (org.apache.solr.update.DeleteUpdateCommand)6 CommitUpdateCommand (org.apache.solr.update.CommitUpdateCommand)5 SolrCore (org.apache.solr.core.SolrCore)4 SolrRequestInfo (org.apache.solr.request.SolrRequestInfo)4 UpdateRequestProcessor (org.apache.solr.update.processor.UpdateRequestProcessor)4 UpdateRequestProcessorChain (org.apache.solr.update.processor.UpdateRequestProcessorChain)4