use of org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor 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.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor 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.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor in project lucene-solr by apache.
the class SkipExistingDocumentsProcessorFactoryTest method testSkipInsertsFalseIfInInitArgs.
@Test
public void testSkipInsertsFalseIfInInitArgs() {
SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
NamedList<Object> initArgs = new NamedList<>();
initArgs.add("skipInsertIfExists", false);
factory.init(initArgs);
UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
SkipExistingDocumentsUpdateProcessor processor = factory.getInstance(defaultRequest, new SolrQueryResponse(), next);
assertFalse("Expected skipInsertIfExists to be false", processor.isSkipInsertIfExists());
assertTrue("Expected skipUpdateIfMissing to be true", processor.isSkipUpdateIfMissing());
}
use of org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor 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.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor 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);
}
Aggregations