Search in sources :

Example 56 with TestOutbox

use of com.hazelcast.jet.core.test.TestOutbox in project hazelcast-jet by hazelcast.

the class StreamKafkaPTest method when_customProjectionToNull_then_filteredOut.

@Test
public void when_customProjectionToNull_then_filteredOut() {
    // When
    WatermarkGenerationParams<String> wmParams = wmGenParams(Long::parseLong, limitingLag(0), noThrottling(), 0);
    StreamKafkaP processor = new StreamKafkaP<Integer, String, String>(properties, singletonList(topic1Name), r -> "0".equals(r.value()) ? null : r.value(), wmParams);
    TestOutbox outbox = new TestOutbox(new int[] { 10 }, 10);
    processor.init(outbox, new TestProcessorContext());
    produce(topic1Name, 0, "0");
    produce(topic1Name, 0, "1");
    // Then
    assertTrueEventually(() -> {
        assertFalse(processor.complete());
        assertFalse("no item in outbox", outbox.queue(0).isEmpty());
    }, 3);
    assertEquals("1", outbox.queue(0).poll());
    assertNull(outbox.queue(0).poll());
}
Also used : TestOutbox(com.hazelcast.jet.core.test.TestOutbox) TestProcessorContext(com.hazelcast.jet.core.test.TestProcessorContext) Test(org.junit.Test)

Aggregations

TestOutbox (com.hazelcast.jet.core.test.TestOutbox)56 TestProcessorContext (com.hazelcast.jet.core.test.TestProcessorContext)50 Test (org.junit.Test)35 QuickTest (com.hazelcast.test.annotation.QuickTest)20 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)19 Processor (com.hazelcast.jet.core.Processor)14 TestInbox (com.hazelcast.jet.core.test.TestInbox)14 ArrayList (java.util.ArrayList)12 Watermark (com.hazelcast.jet.core.Watermark)11 Entry (java.util.Map.Entry)10 Before (org.junit.Before)8 Context (com.hazelcast.jet.core.Processor.Context)6 FunctionEx (com.hazelcast.function.FunctionEx)4 SimpleTestInClusterSupport (com.hazelcast.jet.SimpleTestInClusterSupport)4 Traverser (com.hazelcast.jet.Traverser)4 LongAccumulator (com.hazelcast.jet.accumulator.LongAccumulator)4 Outbox (com.hazelcast.jet.core.Outbox)4 ProcessorMetaSupplier (com.hazelcast.jet.core.ProcessorMetaSupplier)4 ProcessorSupplier (com.hazelcast.jet.core.ProcessorSupplier)4 HashSet (java.util.HashSet)4