use of com.google.api.services.dataflow.model.Sink in project beam by apache.
the class LengthPrefixUnknownCodersTest method testLengthPrefixWriteInstructionCoder.
@Test
public void testLengthPrefixWriteInstructionCoder() throws Exception {
WriteInstruction writeInstruction = new WriteInstruction();
writeInstruction.setSink(new Sink().setCodec(CloudObjects.asCloudObject(windowedValueCoder, /*sdkComponents=*/
null)));
instruction.setWrite(writeInstruction);
ParallelInstruction prefixedInstruction = forParallelInstruction(instruction, false);
assertEqualsAsJson(CloudObjects.asCloudObject(prefixedWindowedValueCoder, /*sdkComponents=*/
null), prefixedInstruction.getWrite().getSink().getCodec());
// Should not mutate the instruction.
assertEqualsAsJson(CloudObjects.asCloudObject(windowedValueCoder, /*sdkComponents=*/
null), writeInstruction.getSink().getCodec());
}
use of com.google.api.services.dataflow.model.Sink in project beam by apache.
the class StreamingDataflowWorkerTest method makeSinkInstruction.
private ParallelInstruction makeSinkInstruction(String streamId, Coder<?> coder, int producerIndex, Coder<? extends BoundedWindow> windowCoder) {
CloudObject spec = CloudObject.forClass(WindmillSink.class);
addString(spec, "stream_id", streamId);
return new ParallelInstruction().setSystemName(DEFAULT_SINK_SYSTEM_NAME).setOriginalName(DEFAULT_SINK_ORIGINAL_NAME).setWrite(new WriteInstruction().setInput(new InstructionInput().setProducerInstructionIndex(producerIndex).setOutputNum(0)).setSink(new Sink().setSpec(spec).setCodec(CloudObjects.asCloudObject(WindowedValue.getFullCoder(coder, windowCoder), /*sdkComponents=*/
null))));
}
Aggregations