use of com.yahoo.processing.test.documentation.AsyncDataProducer 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());
}
Aggregations