com.google.cloud.dataflow.sdk.testing

## 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 unbounded `PCollection` 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 the `Pipeline` after each method before it has completed and no more progress can be made by the `Pipeline`. A `PipelineRunner` must ensure that no more progress can be made in the `Pipeline` before advancing the state of the `TestStream`.

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `TestStream.Builder<T>` An incomplete `TestStream`.
`static class` `TestStream.ElementEvent<T>` An `TestStream.Event` that produces elements.
`static interface` `TestStream.Event<T>` An event in a `TestStream`.
`static class` `TestStream.EventType` The types of `TestStream.Event` that are supported by `TestStream`.
`static class` `TestStream.ProcessingTimeEvent<T>` An `TestStream.Event` that advances the processing time clock.
`static class` `TestStream.WatermarkEvent<T>` An `TestStream.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
`PCollection<T>` `apply(PBegin input)` Applies this `PTransform` on the given `InputT`, and returns its `Output`.
`static <T> TestStream.Builder<T>` `create(Coder<T> coder)` Create a new `TestStream.Builder` with no elements and watermark equal to `BoundedWindow.TIMESTAMP_MIN_VALUE`.
`Coder<TestStream.Event<T>>` `getEventCoder()` Returns a coder suitable for encoding `TestStream.Event`.
`List<TestStream.Event<T>>` `getEvents()` Returns the sequence of `Events` in this `TestStream`.
`Coder<T>` `getValueCoder()`

### Methods inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform

`getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Method Detail

#### create

    public static <T> TestStream.Builder<T> create(Coder<T> coder)

Create a new `TestStream.Builder` with no elements and watermark equal to `BoundedWindow.TIMESTAMP_MIN_VALUE`.

#### apply

    public PCollection<T> apply(PBegin input)

Description copied from class: `PTransform`
Applies this `PTransform` on the given `InputT`, and returns its `Output`.

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 class `PTransform<PBegin,PCollection<T>>`

#### getValueCoder

    public Coder<T> getValueCoder()

#### getEventCoder

    public Coder<TestStream.Event<T>> getEventCoder()

Returns a coder suitable for encoding `TestStream.Event`.

#### getEvents

    public List<TestStream.Event<T>> getEvents()

Returns the sequence of `Events` in this `TestStream`.

For use by `PipelineRunner` authors.