public final class TestSupport extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
drainOutbox(Queue<Object> outboxBucket,
List<Object> outputList)
Move all items from the outbox to the
outputList. |
static Processor |
processorFrom(DistributedSupplier<Processor> supplier)
Gets single processor instance from processor supplier.
|
static Processor |
processorFrom(ProcessorMetaSupplier supplier)
Gets single processor instance from meta processor supplier.
|
static Processor |
processorFrom(ProcessorSupplier supplier)
Gets single processor instance from processor supplier.
|
static <T,U> void |
testProcessor(DistributedSupplier<Processor> supplier,
List<T> input,
List<U> expectedOutput)
Convenience for
testProcessor(Processor, List, List, boolean)
with progress assertion enabled. |
static <T,U> void |
testProcessor(DistributedSupplier<Processor> supplier,
List<T> input,
List<U> expectedOutput,
boolean assertProgress)
Convenience for
testProcessor(Processor, List, List, boolean)
extracting the processor instance from the supplier. |
static <T,U> void |
testProcessor(Processor processor,
List<T> input,
List<U> expectedOutput)
Convenience for
testProcessor(Processor, List, List, boolean)
with progress assertion enabled. |
static <T,U> void |
testProcessor(Processor processor,
List<T> input,
List<U> expectedOutput,
boolean assertProgress)
A utility to test processors.
|
static <T,U> void |
testProcessor(ProcessorMetaSupplier supplier,
List<T> input,
List<U> expectedOutput)
Convenience for
testProcessor(Processor, List, List, boolean)
with progress assertion enabled. |
static <T,U> void |
testProcessor(ProcessorMetaSupplier supplier,
List<T> input,
List<U> expectedOutput,
boolean assertProgress)
Convenience for
testProcessor(Processor, List, List, boolean)
extracting the processor instance from the supplier. |
static <T,U> void |
testProcessor(ProcessorSupplier supplier,
List<T> input,
List<U> expectedOutput)
Convenience for
testProcessor(Processor, List, List, boolean)
with progress assertion enabled. |
static <T,U> void |
testProcessor(ProcessorSupplier supplier,
List<T> input,
List<U> expectedOutput,
boolean assertProgress)
Convenience for
testProcessor(Processor, List, List, boolean)
extracting the processor instance from the supplier. |
public static <T,U> void testProcessor(@Nonnull DistributedSupplier<Processor> supplier, @Nonnull List<T> input, @Nonnull List<U> expectedOutput)
testProcessor(Processor, List, List, boolean)
with progress assertion enabled.public static <T,U> void testProcessor(@Nonnull ProcessorSupplier supplier, @Nonnull List<T> input, @Nonnull List<U> expectedOutput)
testProcessor(Processor, List, List, boolean)
with progress assertion enabled.public static <T,U> void testProcessor(@Nonnull ProcessorMetaSupplier supplier, @Nonnull List<T> input, @Nonnull List<U> expectedOutput)
testProcessor(Processor, List, List, boolean)
with progress assertion enabled.public static <T,U> void testProcessor(@Nonnull Processor processor, @Nonnull List<T> input, @Nonnull List<U> expectedOutput)
testProcessor(Processor, List, List, boolean)
with progress assertion enabled.public static <T,U> void testProcessor(@Nonnull DistributedSupplier<Processor> supplier, @Nonnull List<T> input, @Nonnull List<U> expectedOutput, boolean assertProgress)
testProcessor(Processor, List, List, boolean)
extracting the processor instance from the supplier.public static <T,U> void testProcessor(@Nonnull ProcessorSupplier supplier, @Nonnull List<T> input, @Nonnull List<U> expectedOutput, boolean assertProgress)
testProcessor(Processor, List, List, boolean)
extracting the processor instance from the supplier.public static <T,U> void testProcessor(@Nonnull ProcessorMetaSupplier supplier, @Nonnull List<T> input, @Nonnull List<U> expectedOutput, boolean assertProgress)
testProcessor(Processor, List, List, boolean)
extracting the processor instance from the supplier.public static <T,U> void testProcessor(@Nonnull Processor processor, @Nonnull List<T> input, @Nonnull List<U> expectedOutput, boolean assertProgress)
This method does the following:
Processor.init(
com.hazelcast.jet.Outbox, com.hazelcast.jet.Processor.Context)
Processor.process(0, inbox), the inbox contains all items from
input parameter
process() call: that
something was taken from the inbox or put to the outbox
Processor.complete() until it returns true
complete() call if it
returned false: something must have been put to the outbox.
Processor.tryProcess().
For cooperative processors a 1-capacity outbox will be provided, which
will additionally be full in every other call to process(). This
will test the edge case: the process() method is called even
when the outbox is full to give the processor a chance to process inbox.
This class does not cover these cases:
TestSupport.testProcessor(
Processors.map((String s) -> s.toUpperCase()),
asList("foo", "bar"),
asList("FOO", "BAR")
);
T - input items typeU - output items typeprocessor - a processor instance to testinput - input to passexpectedOutput - expected outputassertProgress - if false, progress will not be asserted after
process() and complete() callstestProcessor(Processor, List, List, boolean)public static void drainOutbox(Queue<Object> outboxBucket, List<Object> outputList)
outputList.outboxBucket - the queue from Outbox to drainoutputList - target listpublic static Processor processorFrom(DistributedSupplier<Processor> supplier)
public static Processor processorFrom(ProcessorSupplier supplier)
public static Processor processorFrom(ProcessorMetaSupplier supplier)
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.