Search in sources :

Example 1 with DummyNullOperation

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());
}
Also used : DummyNullOperation(com.nextdoor.bender.testutils.DummyOperationHelper.DummyNullOperation) ArrayList(java.util.ArrayList) DummyOperationFactory(com.nextdoor.bender.testutils.DummyOperationHelper.DummyOperationFactory) OperationProcessor(com.nextdoor.bender.operation.OperationProcessor) InternalEvent(com.nextdoor.bender.InternalEvent) ArrayList(java.util.ArrayList) List(java.util.List) Queue(com.oath.cyclops.async.adapters.Queue) Test(org.junit.Test)

Example 2 with DummyNullOperation

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());
}
Also used : DummyNullOperation(com.nextdoor.bender.testutils.DummyOperationHelper.DummyNullOperation) ArrayList(java.util.ArrayList) DummyOperationFactory(com.nextdoor.bender.testutils.DummyOperationHelper.DummyOperationFactory) OperationProcessor(com.nextdoor.bender.operation.OperationProcessor) InternalEvent(com.nextdoor.bender.InternalEvent) ArrayList(java.util.ArrayList) List(java.util.List) Queue(com.oath.cyclops.async.adapters.Queue) Test(org.junit.Test)

Aggregations

InternalEvent (com.nextdoor.bender.InternalEvent)2 OperationProcessor (com.nextdoor.bender.operation.OperationProcessor)2 DummyNullOperation (com.nextdoor.bender.testutils.DummyOperationHelper.DummyNullOperation)2 DummyOperationFactory (com.nextdoor.bender.testutils.DummyOperationHelper.DummyOperationFactory)2 Queue (com.oath.cyclops.async.adapters.Queue)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Test (org.junit.Test)2