use of org.apache.beam.sdk.options.PipelineOptions in project beam by apache.
the class ExperimentContextTest method testUnsetExperimentsInPipelineOptions.
@Test
public void testUnsetExperimentsInPipelineOptions() {
PipelineOptions options = PipelineOptionsFactory.create();
ExperimentContext ec = ExperimentContext.parseFrom(options);
assertFalse(ec.isEnabled(Experiment.IntertransformIO));
}
use of org.apache.beam.sdk.options.PipelineOptions in project beam by apache.
the class ReaderFactoryTest method testCreateReader.
@Test
public void testCreateReader() throws Exception {
CloudObject spec = CloudObject.forClass(TestReaderFactory.class);
Source cloudSource = new Source();
cloudSource.setSpec(spec);
cloudSource.setCodec(CloudObjects.asCloudObject(BigEndianIntegerCoder.of(), /*sdkComponents=*/
null));
PipelineOptions options = PipelineOptionsFactory.create();
ReaderRegistry registry = ReaderRegistry.defaultRegistry().register(TestReaderFactory.class.getName(), new TestReaderFactory());
NativeReader<?> reader = registry.create(cloudSource, PipelineOptionsFactory.create(), BatchModeExecutionContext.forTesting(options, "testStage"), null);
assertThat(reader, new IsInstanceOf(TestReader.class));
}
use of org.apache.beam.sdk.options.PipelineOptions in project beam by apache.
the class ShuffleSinkFactoryTest method runTestCreateShuffleSinkHelper.
private ShuffleSink runTestCreateShuffleSinkHelper(byte[] shuffleWriterConfig, String shuffleKind, Coder<?> deserializedCoder, FullWindowedValueCoder<?> coder) throws Exception {
CloudObject spec = CloudObject.forClassName("ShuffleSink");
addString(spec, "shuffle_writer_config", encodeBase64String(shuffleWriterConfig));
addString(spec, "shuffle_kind", shuffleKind);
PipelineOptions options = PipelineOptionsFactory.create();
ShuffleSinkFactory factory = new ShuffleSinkFactory();
Sink<?> sink = factory.create(spec, deserializedCoder, options, BatchModeExecutionContext.forTesting(options, "testStage"), TestOperationContext.create());
assertThat(sink, new IsInstanceOf(ShuffleSink.class));
ShuffleSink shuffleSink = (ShuffleSink) sink;
Assert.assertArrayEquals(shuffleWriterConfig, shuffleSink.shuffleWriterConfig);
Assert.assertEquals(coder, shuffleSink.windowedElemCoder);
return shuffleSink;
}
use of org.apache.beam.sdk.options.PipelineOptions in project beam by apache.
the class ForwardingPTransformTest method validateDelegates.
@Test
public void validateDelegates() {
@SuppressWarnings("unchecked") PipelineOptions options = mock(PipelineOptions.class);
doThrow(RuntimeException.class).when(delegate).validate(options);
thrown.expect(RuntimeException.class);
forwarding.validate(options);
}
use of org.apache.beam.sdk.options.PipelineOptions in project beam by apache.
the class SerializablePipelineOptionsTest method equalityTest.
@Test
public void equalityTest() {
PipelineOptions options = PipelineOptionsFactory.create();
SerializablePipelineOptions serializablePipelineOptions = new SerializablePipelineOptions(options);
String json = serializablePipelineOptions.toString();
SerializablePipelineOptions serializablePipelineOptions2 = new SerializablePipelineOptions(json);
assertEquals("SerializablePipelineOptions created from options and from json differ", serializablePipelineOptions, serializablePipelineOptions2);
}
Aggregations