use of com.nextdoor.bender.testutils.DummyOperationHelper.DummyNullOperation in project bender by Nextdoor.
the class ForkOperationTest method testNullOpFork.
@Test
public void testNullOpFork() {
/*
* Setup the pipeline of operation processors
*/
List<List<OperationProcessor>> forks = new ArrayList<List<OperationProcessor>>();
List<OperationProcessor> fork1 = new ArrayList<OperationProcessor>();
DummyNullOperation nullOp = new DummyNullOperation();
fork1.add(new OperationProcessor(new DummyOperationFactory(nullOp)));
forks.add(fork1);
ForkOperation op = new ForkOperation(forks);
/*
* Create thread that supplies input events
*/
Queue<InternalEvent> inputQueue = new Queue<InternalEvent>();
supply(10, inputQueue);
/*
* Process
*/
Stream<InternalEvent> input = inputQueue.stream();
Stream<InternalEvent> output = op.getOutputStream(input);
List<String> actual = output.map(InternalEvent::getEventString).collect(Collectors.toList());
assertEquals(0, actual.size());
}
use of com.nextdoor.bender.testutils.DummyOperationHelper.DummyNullOperation in project bender by Nextdoor.
the class ForkOperationTest method testNullOpFork1.
@Test
public void testNullOpFork1() {
/*
* Setup the pipeline of operation processors
*/
List<List<OperationProcessor>> forks = new ArrayList<List<OperationProcessor>>();
List<OperationProcessor> fork1 = new ArrayList<OperationProcessor>();
fork1.add(new OperationProcessor(new DummyOperationFactory()));
forks.add(fork1);
List<OperationProcessor> fork2 = new ArrayList<OperationProcessor>();
DummyNullOperation nullOp = new DummyNullOperation();
fork2.add(new OperationProcessor(new DummyOperationFactory(nullOp)));
forks.add(fork2);
ForkOperation op = new ForkOperation(forks);
/*
* Create thread that supplies input events
*/
Queue<InternalEvent> inputQueue = new Queue<InternalEvent>();
supply(10, inputQueue);
/*
* Process
*/
Stream<InternalEvent> input = inputQueue.stream();
Stream<InternalEvent> output = op.getOutputStream(input);
List<String> actual = output.map(InternalEvent::getEventString).collect(Collectors.toList());
assertEquals(10, actual.size());
}
Aggregations