use of org.talend.components.localio.rowgenerator.RowGeneratorProperties in project components by Talend.
the class SandboxedRowGeneratorRuntimeTest method testBasic.
@Test
public void testBasic() throws Exception {
final RowGeneratorProperties props = createComponentProperties();
props.schemaFlow.schema.setValue(SampleSchemas.recordSimple());
props.nbRows.setValue(95L);
props.nbPartitions.setValue(10);
RuntimeInfo ri = def.getRuntimeInfo(ExecutionEngine.BEAM, props, ConnectorTopology.OUTGOING);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
RuntimableRuntime<RowGeneratorProperties> runtime = (RuntimableRuntime<RowGeneratorProperties>) si.getInstance();
runtime.initialize(null, props);
}
}
use of org.talend.components.localio.rowgenerator.RowGeneratorProperties in project components by Talend.
the class RowGeneratorRuntimeTest method testBasic.
@Test
public void testBasic() {
RowGeneratorProperties componentProps = new RowGeneratorProperties(null);
componentProps.init();
componentProps.schemaFlow.schema.setValue(SampleSchemas.recordSimple());
componentProps.nbRows.setValue(95L);
componentProps.nbPartitions.setValue(10);
RowGeneratorRuntime runtime = new RowGeneratorRuntime();
runtime.initialize(null, componentProps);
// Use the component in the pipeline.
PCollection<IndexedRecord> output = pipeline.apply(runtime);
PAssert.thatSingleton(output.apply("Count", Count.<IndexedRecord>globally())).isEqualTo(95L);
pipeline.run().waitUntilFinish();
}
use of org.talend.components.localio.rowgenerator.RowGeneratorProperties in project components by Talend.
the class SandboxedRowGeneratorRuntimeTest method createComponentProperties.
/**
* @return the properties for this component, fully initialized with the default values.
*/
public static RowGeneratorProperties createComponentProperties() {
// Configure the component.
RowGeneratorProperties componentProps = new RowGeneratorProperties(null);
componentProps.init();
return componentProps;
}
Aggregations