use of com.hazelcast.jet.core.Outbox in project hazelcast by hazelcast.
the class WriteLoggerPTest method test.
@Test
public void test() throws Exception {
// Given
Processor p = supplierFrom(writeLoggerP()).get();
TestInbox inbox = new TestInbox();
Outbox outbox = mock(Outbox.class);
ILogger logger = mock(ILogger.class);
p.init(outbox, new TestProcessorContext().setLogger(logger));
// When
inbox.add(1);
p.process(0, inbox);
Watermark wm = new Watermark(2);
p.tryProcessWatermark(wm);
// Then
verifyZeroInteractions(outbox);
verify(logger).info("1");
verify(logger).fine(wm.toString());
verifyZeroInteractions(logger);
}
use of com.hazelcast.jet.core.Outbox in project hazelcast-jet by hazelcast.
the class SessionWindowP_failoverTest method init.
private void init(ProcessingGuarantee guarantee) {
AggregateOperation1<Object, LongAccumulator, Long> aggrOp = counting();
p = new SessionWindowP<>(5000, singletonList((DistributedToLongFunction<Entry<?, Long>>) Entry::getValue), singletonList(entryKey()), aggrOp, WindowResult::new);
Outbox outbox = new TestOutbox(128);
Context context = new TestProcessorContext().setProcessingGuarantee(guarantee);
p.init(outbox, context);
}
use of com.hazelcast.jet.core.Outbox in project hazelcast-jet by hazelcast.
the class SlidingWindowP_failoverTest method init.
private void init(ProcessingGuarantee guarantee) {
SlidingWindowPolicy wDef = SlidingWindowPolicy.tumblingWinPolicy(1);
AggregateOperation1<Object, LongAccumulator, Long> aggrOp = counting();
p = new SlidingWindowP<>(singletonList(entryKey()), singletonList((DistributedToLongFunction<Entry<?, Long>>) Entry::getValue), wDef, aggrOp, TimestampedEntry::new, true);
Outbox outbox = new TestOutbox(128);
Context context = new TestProcessorContext().setProcessingGuarantee(guarantee);
p.init(outbox, context);
}
use of com.hazelcast.jet.core.Outbox in project hazelcast-jet by hazelcast.
the class WriteBufferedPTest method writeBuffered_smokeTest.
@Test
public void writeBuffered_smokeTest() {
DistributedSupplier<Processor> supplier = getLoggingBufferedWriter();
Processor p = supplier.get();
Outbox outbox = mock(Outbox.class);
p.init(outbox, mock(Context.class));
TestInbox inbox = new TestInbox();
inbox.add(1);
inbox.add(2);
p.process(0, inbox);
inbox.add(3);
inbox.add(4);
p.process(0, inbox);
// watermark should not be written
p.tryProcessWatermark(new Watermark(0));
// empty flush
p.process(0, inbox);
p.complete();
assertEquals(asList("new", "add:1", "add:2", "flush", "add:3", "add:4", "flush", "flush", "dispose"), events);
assertEquals(0, inbox.size());
verifyZeroInteractions(outbox);
}
Aggregations