Search in sources :

Example 1 with EuphoriaOptions

use of org.apache.beam.sdk.extensions.euphoria.core.translate.EuphoriaOptions in project beam by apache.

the class AbstractOperatorTest method execute.

/**
 * Run all tests with given runner.
 *
 * @param tc the test case to executeSync
 */
@SuppressWarnings("unchecked")
public <T> void execute(TestCase<T> tc) {
    final SingleJvmAccumulatorProvider.Factory accumulatorProvider = SingleJvmAccumulatorProvider.Factory.get();
    final PipelineOptions pipelineOptions = PipelineOptionsFactory.create();
    final EuphoriaOptions euphoriaOptions = pipelineOptions.as(EuphoriaOptions.class);
    euphoriaOptions.setAccumulatorProviderFactory(accumulatorProvider);
    final Pipeline pipeline = TestPipeline.create(pipelineOptions);
    pipeline.getCoderRegistry().registerCoderForClass(Object.class, KryoCoder.of(pipelineOptions));
    final PCollection<T> output = tc.getOutput(pipeline);
    tc.validate(output);
    pipeline.run().waitUntilFinish();
    tc.validateAccumulators(accumulatorProvider);
}
Also used : SingleJvmAccumulatorProvider(org.apache.beam.sdk.extensions.euphoria.core.testkit.accumulators.SingleJvmAccumulatorProvider) EuphoriaOptions(org.apache.beam.sdk.extensions.euphoria.core.translate.EuphoriaOptions) PipelineOptions(org.apache.beam.sdk.options.PipelineOptions) TestPipeline(org.apache.beam.sdk.testing.TestPipeline) Pipeline(org.apache.beam.sdk.Pipeline)

Aggregations

Pipeline (org.apache.beam.sdk.Pipeline)1 SingleJvmAccumulatorProvider (org.apache.beam.sdk.extensions.euphoria.core.testkit.accumulators.SingleJvmAccumulatorProvider)1 EuphoriaOptions (org.apache.beam.sdk.extensions.euphoria.core.translate.EuphoriaOptions)1 PipelineOptions (org.apache.beam.sdk.options.PipelineOptions)1 TestPipeline (org.apache.beam.sdk.testing.TestPipeline)1