Search in sources :

Example 1 with RowGeneratorProperties

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);
    }
}
Also used : SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) RuntimableRuntime(org.talend.components.api.component.runtime.RuntimableRuntime) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) RowGeneratorProperties(org.talend.components.localio.rowgenerator.RowGeneratorProperties) Test(org.junit.Test)

Example 2 with RowGeneratorProperties

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();
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) RowGeneratorProperties(org.talend.components.localio.rowgenerator.RowGeneratorProperties) Test(org.junit.Test)

Example 3 with RowGeneratorProperties

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;
}
Also used : RowGeneratorProperties(org.talend.components.localio.rowgenerator.RowGeneratorProperties)

Aggregations

RowGeneratorProperties (org.talend.components.localio.rowgenerator.RowGeneratorProperties)3 Test (org.junit.Test)2 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 RuntimableRuntime (org.talend.components.api.component.runtime.RuntimableRuntime)1 RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)1 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)1