Search in sources :

Example 1 with DocumentProcessingHandlerParameters

use of com.yahoo.docproc.jdisc.DocumentProcessingHandlerParameters in project vespa by vespa-engine.

the class VespaFeedHandlerTestCase method setup.

public void setup(com.yahoo.messagebus.Error e, LoadTypeConfig loadTypeCfg, boolean autoReply, DummySessionFactory.ReplyFactory autoReplyFactory) throws Exception {
    DocumentTypeManager docMan = new DocumentTypeManager();
    DocumentTypeManagerConfigurer.configure(docMan, "file:" + xmlFilesPath + "documentmanager.cfg");
    if (autoReply) {
        if (autoReplyFactory != null) {
            factory = DummySessionFactory.createWithAutoReplyFactory(autoReplyFactory);
        } else {
            factory = DummySessionFactory.createWithErrorAutoReply(e);
        }
    } else {
        factory = DummySessionFactory.createDefault();
    }
    context = new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder()), loadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric());
    Executor threadPool = Executors.newCachedThreadPool();
    feedHandler = new VespaFeedHandler(context, threadPool);
    removeHandler = new VespaFeedHandlerRemove(context, threadPool);
    statusHandler = new VespaFeedHandlerStatus(context, false, false, threadPool);
    removeLocationHandler = new VespaFeedHandlerRemoveLocation(context, threadPool);
    CallStack dpCallstack = new CallStack("bar");
    dpCallstack.addLast(new TestDocProc());
    dpCallstack.addLast(new TestLaterDocProc());
    DocprocService myservice = new DocprocService("bar");
    myservice.setCallStack(dpCallstack);
    myservice.setInService(true);
    ComponentRegistry<DocprocService> registry = new ComponentRegistry<DocprocService>();
    registry.register(new ComponentId(myservice.getName()), myservice);
    DocumentProcessingHandler handler = new DocumentProcessingHandler(registry, new ComponentRegistry<>(), new ComponentRegistry<>(), new DocumentProcessingHandlerParameters());
    Container container = Container.get();
    ComponentRegistry<RequestHandler> requestHandlerComponentRegistry = new ComponentRegistry<>();
    requestHandlerComponentRegistry.register(new ComponentId(DocumentProcessingHandler.class.getName()), handler);
    container.setRequestHandlerRegistry(requestHandlerComponentRegistry);
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) CallStack(com.yahoo.docproc.CallStack) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) Container(com.yahoo.container.Container) Executor(java.util.concurrent.Executor) DocumentProcessingHandler(com.yahoo.docproc.jdisc.DocumentProcessingHandler) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) RequestHandler(com.yahoo.jdisc.handler.RequestHandler) ComponentRegistry(com.yahoo.component.provider.ComponentRegistry) FeedContext(com.yahoo.feedapi.FeedContext) ComponentId(com.yahoo.component.ComponentId) DocumentProcessingHandlerParameters(com.yahoo.docproc.jdisc.DocumentProcessingHandlerParameters)

Aggregations

ComponentId (com.yahoo.component.ComponentId)1 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)1 Container (com.yahoo.container.Container)1 CallStack (com.yahoo.docproc.CallStack)1 DocumentProcessingHandler (com.yahoo.docproc.jdisc.DocumentProcessingHandler)1 DocumentProcessingHandlerParameters (com.yahoo.docproc.jdisc.DocumentProcessingHandlerParameters)1 FeedContext (com.yahoo.feedapi.FeedContext)1 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)1 RequestHandler (com.yahoo.jdisc.handler.RequestHandler)1 ClusterList (com.yahoo.vespaclient.ClusterList)1 FeederConfig (com.yahoo.vespaclient.config.FeederConfig)1 Executor (java.util.concurrent.Executor)1