use of org.apache.beam.runners.dataflow.worker.util.TimerOrElement.TimerOrElementCoder in project beam by apache.
the class TimerOrElementTest method testCoderCanBeDecodedFromCloudObject.
@Test
public void testCoderCanBeDecodedFromCloudObject() {
CloudObject cloudObject = CloudObject.forClassName("com.google.cloud.dataflow.sdk.util.TimerOrElement$TimerOrElementCoder");
List<CloudObject> component = Collections.singletonList(CloudObjects.asCloudObject(KvCoder.of(VarLongCoder.of(), ByteArrayCoder.of()), /*sdkComponents=*/
null));
Structs.addList(cloudObject, PropertyNames.COMPONENT_ENCODINGS, component);
Coder<?> decoded = CloudObjects.coderFromCloudObject(cloudObject);
assertThat(decoded, instanceOf(TimerOrElementCoder.class));
TimerOrElementCoder<?> decodedCoder = (TimerOrElementCoder<?>) decoded;
assertThat(decodedCoder.getKeyCoder(), equalTo(VarLongCoder.of()));
assertThat(decodedCoder.getElementCoder(), equalTo(ByteArrayCoder.of()));
}
Aggregations