Search in sources :

Example 1 with SourceOperationRequest

use of com.google.api.services.dataflow.model.SourceOperationRequest in project beam by apache.

the class SourceOperationExecutorFactoryTest method testCreateWithFnApi.

@Test
public void testCreateWithFnApi() throws Exception {
    SourceOperationRequest request = new SourceOperationRequest().setName("name").setOriginalName("original").setSystemName("system").setStageName("stage");
    PipelineOptions options = PipelineOptionsFactory.fromArgs(new String[] { "--experiments=beam_fn_api" }).create();
    assertThat(SourceOperationExecutorFactory.create(options, request, null, executionContext, "STAGE"), instanceOf(NoOpSourceOperationExecutor.class));
}
Also used : SourceOperationRequest(com.google.api.services.dataflow.model.SourceOperationRequest) PipelineOptions(org.apache.beam.sdk.options.PipelineOptions) Test(org.junit.Test)

Example 2 with SourceOperationRequest

use of com.google.api.services.dataflow.model.SourceOperationRequest in project beam by apache.

the class SourceOperationExecutorFactoryTest method testCreateDefault.

@Test
public void testCreateDefault() throws Exception {
    SourceOperationRequest request = new SourceOperationRequest().setName("name").setOriginalName("original").setSystemName("system").setStageName("stage").setSplit(new SourceSplitRequest());
    DataflowOperationContext mockOperation = Mockito.mock(DataflowOperationContext.class);
    Mockito.when(executionContext.createOperationContext(Mockito.isA(NameContext.class))).thenReturn(mockOperation);
    SourceOperationExecutor sourceOperationExecutor = SourceOperationExecutorFactory.create(PipelineOptionsFactory.create(), request, null, executionContext, "STAGE");
    assertThat(sourceOperationExecutor, instanceOf(WorkerCustomSourceOperationExecutor.class));
}
Also used : SourceOperationRequest(com.google.api.services.dataflow.model.SourceOperationRequest) NameContext(org.apache.beam.runners.dataflow.worker.counters.NameContext) SourceSplitRequest(com.google.api.services.dataflow.model.SourceSplitRequest) Test(org.junit.Test)

Example 3 with SourceOperationRequest

use of com.google.api.services.dataflow.model.SourceOperationRequest in project beam by apache.

the class NoOpSourceOperationExecutorTest method setUp.

@Before
public void setUp() {
    SourceSplitRequest splitRequest = new SourceSplitRequest();
    SourceOperationRequest operationRequest = new SourceOperationRequest().setSplit(splitRequest);
    executor = new NoOpSourceOperationExecutor(operationRequest);
}
Also used : SourceOperationRequest(com.google.api.services.dataflow.model.SourceOperationRequest) SourceSplitRequest(com.google.api.services.dataflow.model.SourceSplitRequest) Before(org.junit.Before)

Aggregations

SourceOperationRequest (com.google.api.services.dataflow.model.SourceOperationRequest)3 SourceSplitRequest (com.google.api.services.dataflow.model.SourceSplitRequest)2 Test (org.junit.Test)2 NameContext (org.apache.beam.runners.dataflow.worker.counters.NameContext)1 PipelineOptions (org.apache.beam.sdk.options.PipelineOptions)1 Before (org.junit.Before)1