use of org.apache.beam.runners.flink.translation.utils.SerializedPipelineOptions in project beam by apache.
the class PipelineOptionsTest method beforeTest.
@BeforeClass
public static void beforeTest() {
options = PipelineOptionsFactory.fromArgs(args).as(MyOptions.class);
serializedOptions = new SerializedPipelineOptions(options);
}
use of org.apache.beam.runners.flink.translation.utils.SerializedPipelineOptions in project beam by apache.
the class PipelineOptionsTest method testSerializingPipelineOptionsWithCustomUserType.
@Test
public void testSerializingPipelineOptionsWithCustomUserType() throws Exception {
String expectedValue = "testValue";
PipelineOptions options = PipelineOptionsFactory.fromArgs("--jacksonIncompatible=\"" + expectedValue + "\"").as(JacksonIncompatibleOptions.class);
SerializedPipelineOptions context = new SerializedPipelineOptions(options);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ObjectOutputStream outputStream = new ObjectOutputStream(baos)) {
outputStream.writeObject(context);
}
try (ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
SerializedPipelineOptions copy = (SerializedPipelineOptions) inputStream.readObject();
assertEquals(expectedValue, copy.getPipelineOptions().as(JacksonIncompatibleOptions.class).getJacksonIncompatible().value);
}
}
use of org.apache.beam.runners.flink.translation.utils.SerializedPipelineOptions in project beam by apache.
the class PipelineOptionsTest method testIgnoredFieldSerialization.
@Test
public void testIgnoredFieldSerialization() {
FlinkPipelineOptions options = PipelineOptionsFactory.as(FlinkPipelineOptions.class);
options.setStateBackend(new MemoryStateBackend());
FlinkPipelineOptions deserialized = new SerializedPipelineOptions(options).getPipelineOptions().as(FlinkPipelineOptions.class);
assertNull(deserialized.getStateBackend());
}
Aggregations