Search in sources :

Example 1 with AsyncDataProcessingInitiator

use of com.yahoo.processing.test.documentation.AsyncDataProcessingInitiator in project vespa by vespa-engine.

the class DocumentationTestCase method test.

@SuppressWarnings("unchecked")
@Test
public final void test() {
    Processor p = new ExampleProcessor();
    Chain<Processor> basic = new Chain<>(p);
    Processor initiator = new AsyncDataProcessingInitiator(basic);
    Chain<Processor> postProcessing = new Chain<>(initiator);
    Execution e = Execution.createRoot(postProcessing, 0, Execution.Environment.createEmpty());
    Response r = e.process(new Request());
    // just adds a listener to the result returned from basic
    assertEquals(0, r.data().asList().size());
    Processor producer = new AsyncDataProducer();
    Chain<Processor> asyncChain = new Chain<>(producer);
    Processor federator = new Federator(basic, asyncChain);
    e = Execution.createRoot(federator, 0, Execution.Environment.createEmpty());
    r = e.process(new Request());
    assertEquals(2, r.data().asList().size());
}
Also used : Response(com.yahoo.processing.Response) AsyncDataProducer(com.yahoo.processing.test.documentation.AsyncDataProducer) Chain(com.yahoo.component.chain.Chain) AsyncDataProcessingInitiator(com.yahoo.processing.test.documentation.AsyncDataProcessingInitiator) Federator(com.yahoo.processing.test.documentation.Federator) ExampleProcessor(com.yahoo.processing.test.documentation.ExampleProcessor) Processor(com.yahoo.processing.Processor) Execution(com.yahoo.processing.execution.Execution) ExampleProcessor(com.yahoo.processing.test.documentation.ExampleProcessor) Request(com.yahoo.processing.Request) Test(org.junit.Test)

Aggregations

Chain (com.yahoo.component.chain.Chain)1 Processor (com.yahoo.processing.Processor)1 Request (com.yahoo.processing.Request)1 Response (com.yahoo.processing.Response)1 Execution (com.yahoo.processing.execution.Execution)1 AsyncDataProcessingInitiator (com.yahoo.processing.test.documentation.AsyncDataProcessingInitiator)1 AsyncDataProducer (com.yahoo.processing.test.documentation.AsyncDataProducer)1 ExampleProcessor (com.yahoo.processing.test.documentation.ExampleProcessor)1 Federator (com.yahoo.processing.test.documentation.Federator)1 Test (org.junit.Test)1