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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations