Example usage for org.apache.solr.update.processor UpdateRequestProcessorChain UpdateRequestProcessorChain

List of usage examples for org.apache.solr.update.processor UpdateRequestProcessorChain UpdateRequestProcessorChain

Introduction

In this page you can find the example usage for org.apache.solr.update.processor UpdateRequestProcessorChain UpdateRequestProcessorChain.

Prototype

public UpdateRequestProcessorChain(List<UpdateRequestProcessorFactory> chain, SolrCore solrCore) 

Source Link

Document

Creates a chain backed directly by the specified list.

Usage

From source file:org.alfresco.solr.SolrCoreTestBase.java

License:Open Source License

@Before
public void setUpBase() throws Exception {
    Properties properties = new Properties();
    properties.put("solr.tests.maxBufferedDocs", "1000");
    properties.put("solr.tests.maxIndexingThreads", "10");
    properties.put("solr.tests.ramBufferSizeMB", "1024");
    properties.put("solr.tests.mergeScheduler", "org.apache.lucene.index.ConcurrentMergeScheduler");
    properties.put("solr.tests.mergePolicy", "org.apache.lucene.index.TieredMergePolicy");

    coreContainer = new CoreContainer(TEST_FILES_LOCATION);
    resourceLoader = new SolrResourceLoader(Paths.get(TEST_SOLR_CONF), null, properties);
    SolrConfig solrConfig = new SolrConfig(resourceLoader, "solrconfig-afts.xml", null);
    IndexSchemaFactory.buildIndexSchema("schema-afts.xml", solrConfig);
    coreDescriptor = new CoreDescriptor(coreContainer, "name", Paths.get(TEST_SOLR_COLLECTION));

    // SolrCore is final, we can't mock with mockito
    core = new SolrCore("name", null, solrConfig, null, null, coreDescriptor, null, null, null);

    FieldUtils.writeField(core, "updateHandler", updateHandler, true);
    FieldUtils.writeField(core, "resourceLoader", resourceLoader, true);
    infoRegistry = new HashMap<String, SolrInfoMBean>();
    FieldUtils.writeField(core, "infoRegistry", infoRegistry, true);
    reqHandlers = new RequestHandlers(core);
    reqHandlers.register("/select", selectRequestHandler);
    reqHandlers.register("/afts", aftsRequestHandler);
    FieldUtils.writeField(core, "reqHandlers", reqHandlers, true);

    Map<String, UpdateRequestProcessorChain> map = new HashMap<>();
    List<UpdateRequestProcessorFactory> factories = new ArrayList<UpdateRequestProcessorFactory>(1);
    factories.add(runUpdateProcessorFactory);
    when(runUpdateProcessorFactory.getInstance(any(SolrQueryRequest.class), any(SolrQueryResponse.class),
            any(UpdateRequestProcessor.class))).thenReturn(processor);
    UpdateRequestProcessorChain def = new UpdateRequestProcessorChain(factories, core);
    map.put(null, def);/* w w  w. j ava  2  s  .  co  m*/
    map.put("", def);
    FieldUtils.writeField(core, "updateProcessorChains", map, true);
}