use of org.apache.flink.streaming.api.functions.source.datagen.DataGeneratorSource in project flink by apache.
the class DataGenTableSourceFactoryTest method runGenerator.
private List<RowData> runGenerator(ResolvedSchema schema, DescriptorProperties descriptor) throws Exception {
DynamicTableSource source = createTableSource(schema, descriptor.asMap());
assertTrue(source instanceof DataGenTableSource);
DataGenTableSource dataGenTableSource = (DataGenTableSource) source;
DataGeneratorSource<RowData> gen = dataGenTableSource.createSource();
// test java serialization.
gen = InstantiationUtil.clone(gen);
StreamSource<RowData, DataGeneratorSource<RowData>> src = new StreamSource<>(gen);
AbstractStreamOperatorTestHarness<RowData> testHarness = new AbstractStreamOperatorTestHarness<>(src, 1, 1, 0);
testHarness.open();
TestContext ctx = new TestContext();
gen.run(ctx);
return ctx.results;
}
Aggregations