Search in sources :

Example 1 with FnDataReceiver

use of org.apache.beam.sdk.fn.data.FnDataReceiver in project flink by apache.

the class PythonTestUtils method createMockJobBundleFactory.

public static JobBundleFactory createMockJobBundleFactory() {
    JobBundleFactory jobBundleFactorySpy = spy(JobBundleFactory.class);
    StageBundleFactory stageBundleFactorySpy = spy(StageBundleFactory.class);
    when(jobBundleFactorySpy.forStage(any())).thenReturn(stageBundleFactorySpy);
    ProcessBundleDescriptors.ExecutableProcessBundleDescriptor processBundleDescriptor = spy(ProcessBundleDescriptors.ExecutableProcessBundleDescriptor.class);
    when(stageBundleFactorySpy.getProcessBundleDescriptor()).thenReturn(processBundleDescriptor);
    RemoteBundle remoteBundleSpy = spy(RemoteBundle.class);
    try {
        when(stageBundleFactorySpy.getBundle(any(OutputReceiverFactory.class), any(TimerReceiverFactory.class), any(StateRequestHandler.class), any(BundleProgressHandler.class))).thenReturn(remoteBundleSpy);
    } catch (Exception e) {
    // ignore
    }
    Map<String, FnDataReceiver> inputReceivers = new HashMap<>();
    FnDataReceiver<WindowedValue<?>> windowedValueReceiverSpy = spy(FnDataReceiver.class);
    inputReceivers.put("input", windowedValueReceiverSpy);
    when(remoteBundleSpy.getInputReceivers()).thenReturn(inputReceivers);
    return jobBundleFactorySpy;
}
Also used : StateRequestHandler(org.apache.beam.runners.fnexecution.state.StateRequestHandler) FnDataReceiver(org.apache.beam.sdk.fn.data.FnDataReceiver) HashMap(java.util.HashMap) ProcessBundleDescriptors(org.apache.beam.runners.fnexecution.control.ProcessBundleDescriptors) JobBundleFactory(org.apache.beam.runners.fnexecution.control.JobBundleFactory) StageBundleFactory(org.apache.beam.runners.fnexecution.control.StageBundleFactory) OutputReceiverFactory(org.apache.beam.runners.fnexecution.control.OutputReceiverFactory) WindowedValue(org.apache.beam.sdk.util.WindowedValue) TimerReceiverFactory(org.apache.beam.runners.fnexecution.control.TimerReceiverFactory) RemoteBundle(org.apache.beam.runners.fnexecution.control.RemoteBundle) BundleProgressHandler(org.apache.beam.runners.fnexecution.control.BundleProgressHandler)

Aggregations

HashMap (java.util.HashMap)1 BundleProgressHandler (org.apache.beam.runners.fnexecution.control.BundleProgressHandler)1 JobBundleFactory (org.apache.beam.runners.fnexecution.control.JobBundleFactory)1 OutputReceiverFactory (org.apache.beam.runners.fnexecution.control.OutputReceiverFactory)1 ProcessBundleDescriptors (org.apache.beam.runners.fnexecution.control.ProcessBundleDescriptors)1 RemoteBundle (org.apache.beam.runners.fnexecution.control.RemoteBundle)1 StageBundleFactory (org.apache.beam.runners.fnexecution.control.StageBundleFactory)1 TimerReceiverFactory (org.apache.beam.runners.fnexecution.control.TimerReceiverFactory)1 StateRequestHandler (org.apache.beam.runners.fnexecution.state.StateRequestHandler)1 FnDataReceiver (org.apache.beam.sdk.fn.data.FnDataReceiver)1 WindowedValue (org.apache.beam.sdk.util.WindowedValue)1