use of org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor in project lucene-solr by apache.
the class SkipExistingDocumentsProcessorFactoryTest method testSkipUpdatesFalseIfInitArgsTrueButFalseBooleanInRequest.
@Test
public void testSkipUpdatesFalseIfInitArgsTrueButFalseBooleanInRequest() {
SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
NamedList<Object> initArgs = new NamedList<>();
initArgs.add("skipUpdateIfMissing", true);
factory.init(initArgs);
NamedList<Object> requestArgs = new NamedList<>();
requestArgs.add("skipUpdateIfMissing", false);
SolrQueryRequest req = new LocalSolrQueryRequest(null, requestArgs);
UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
SkipExistingDocumentsUpdateProcessor processor = factory.getInstance(req, new SolrQueryResponse(), next);
assertTrue("Expected skipInsertIfExists to be true", processor.isSkipInsertIfExists());
assertFalse("Expected skipUpdateIfMissing to be false", processor.isSkipUpdateIfMissing());
}
use of org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor in project lucene-solr by apache.
the class SkipExistingDocumentsProcessorFactoryTest method testSkipInsertsFalseIfInitArgsTrueButFalseStringInRequest.
@Test
public void testSkipInsertsFalseIfInitArgsTrueButFalseStringInRequest() {
SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
NamedList<Object> initArgs = new NamedList<>();
initArgs.add("skipInsertIfExists", true);
factory.init(initArgs);
NamedList<String> requestArgs = new NamedList<>();
requestArgs.add("skipInsertIfExists", "false");
SolrQueryRequest req = new LocalSolrQueryRequest(null, requestArgs);
UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
SkipExistingDocumentsUpdateProcessor processor = factory.getInstance(req, 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 testSkipBothFalseIfInInitArgs.
@Test
public void testSkipBothFalseIfInInitArgs() {
SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
NamedList<Object> initArgs = new NamedList<>();
initArgs.add("skipInsertIfExists", false);
initArgs.add("skipUpdateIfMissing", 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());
assertFalse("Expected skipUpdateIfMissing to be false", processor.isSkipUpdateIfMissing());
}
use of org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor in project lucene-solr by apache.
the class SkipExistingDocumentsProcessorFactoryTest method testSkippableInsertIsNotSkippedIfSkipInsertsFalse.
@Test
public void testSkippableInsertIsNotSkippedIfSkipInsertsFalse() throws IOException {
UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
SkipExistingDocumentsUpdateProcessor processor = Mockito.spy(new SkipExistingDocumentsUpdateProcessor(defaultRequest, next, false, false));
AddUpdateCommand cmd = createInsertUpdateCmd(defaultRequest);
doReturn(true).when(processor).isLeader(cmd);
doReturn(true).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 testNonSkippableUpdateIsNotSkippedIfSkipUpdatesTrue.
@Test
public void testNonSkippableUpdateIsNotSkippedIfSkipUpdatesTrue() throws IOException {
UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
SkipExistingDocumentsUpdateProcessor processor = Mockito.spy(new SkipExistingDocumentsUpdateProcessor(defaultRequest, next, false, true));
AddUpdateCommand cmd = createAtomicUpdateCmd(defaultRequest);
doReturn(true).when(processor).isLeader(cmd);
doReturn(true).when(processor).doesDocumentExist(docId);
processor.processAdd(cmd);
verify(next).processAdd(cmd);
}
Aggregations