Google Cloud Dataflow SDK for Java, version 1.9.1
Class TestStream<T>
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.transforms.PTransform<PBegin,PCollection<T>>
-
- com.google.cloud.dataflow.sdk.testing.TestStream<T>
-
- All Implemented Interfaces:
- HasDisplayData, Serializable
public final class TestStream<T> extends PTransform<PBegin,PCollection<T>>
A testing input that generates an unboundedPCollection
of elements, advancing the watermark and processing time as elements are emitted. After all of the specified elements are emitted, ceases to produce output.Each call to a
TestStream.Builder
method will only be reflected in the state of thePipeline
after each method before it has completed and no more progress can be made by thePipeline
. APipelineRunner
must ensure that no more progress can be made in thePipeline
before advancing the state of theTestStream
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
TestStream.Builder<T>
An incompleteTestStream
.static class
TestStream.ElementEvent<T>
AnTestStream.Event
that produces elements.static interface
TestStream.Event<T>
An event in aTestStream
.static class
TestStream.EventType
The types ofTestStream.Event
that are supported byTestStream
.static class
TestStream.ProcessingTimeEvent<T>
AnTestStream.Event
that advances the processing time clock.static class
TestStream.WatermarkEvent<T>
AnTestStream.Event
that advances the watermark.
-
Field Summary
-
Fields inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
name
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description PCollection<T>
apply(PBegin input)
Applies thisPTransform
on the givenInputT
, and returns itsOutput
.static <T> TestStream.Builder<T>
create(Coder<T> coder)
Create a newTestStream.Builder
with no elements and watermark equal toBoundedWindow.TIMESTAMP_MIN_VALUE
.Coder<TestStream.Event<T>>
getEventCoder()
Returns a coder suitable for encodingTestStream.Event
.List<TestStream.Event<T>>
getEvents()
Returns the sequence ofEvents
in thisTestStream
.Coder<T>
getValueCoder()
-
Methods inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate
-
-
-
-
Method Detail
-
create
public static <T> TestStream.Builder<T> create(Coder<T> coder)
Create a newTestStream.Builder
with no elements and watermark equal toBoundedWindow.TIMESTAMP_MIN_VALUE
.
-
apply
public PCollection<T> apply(PBegin input)
Description copied from class:PTransform
Applies thisPTransform
on the givenInputT
, and returns itsOutput
.Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
The default implementation throws an exception. A derived class must either implement apply, or else each runner must supply a custom implementation via
PipelineRunner.apply(com.google.cloud.dataflow.sdk.transforms.PTransform<InputT, OutputT>, InputT)
.- Overrides:
apply
in classPTransform<PBegin,PCollection<T>>
-
getEventCoder
public Coder<TestStream.Event<T>> getEventCoder()
Returns a coder suitable for encodingTestStream.Event
.
-
getEvents
public List<TestStream.Event<T>> getEvents()
-
-