use of org.apache.beam.runners.flink.metrics.FlinkMetricContainer in project beam by apache.
the class FlinkStatefulDoFnFunctionTest method testAccumulatorRegistrationOnOperatorClose.
@Test
public void testAccumulatorRegistrationOnOperatorClose() throws Exception {
FlinkStatefulDoFnFunction doFnFunction = new TestDoFnFunction("step", WindowingStrategy.globalDefault(), Collections.emptyMap(), PipelineOptionsFactory.create(), Collections.emptyMap(), new TupleTag<>(), null, Collections.emptyMap(), DoFnSchemaInformation.create(), Collections.emptyMap());
doFnFunction.open(new Configuration());
String metricContainerFieldName = "metricContainer";
FlinkMetricContainer monitoredContainer = Mockito.spy((FlinkMetricContainer) Whitebox.getInternalState(doFnFunction, metricContainerFieldName));
Whitebox.setInternalState(doFnFunction, metricContainerFieldName, monitoredContainer);
doFnFunction.close();
Mockito.verify(monitoredContainer).registerMetricsForPipelineResult();
}
use of org.apache.beam.runners.flink.metrics.FlinkMetricContainer in project beam by apache.
the class FlinkDoFnFunctionTest method testAccumulatorRegistrationOnOperatorClose.
@Test
public void testAccumulatorRegistrationOnOperatorClose() throws Exception {
FlinkDoFnFunction doFnFunction = new TestDoFnFunction("step", WindowingStrategy.globalDefault(), Collections.emptyMap(), PipelineOptionsFactory.create(), Collections.emptyMap(), new TupleTag<>(), null, Collections.emptyMap(), DoFnSchemaInformation.create(), Collections.emptyMap());
doFnFunction.open(new Configuration());
String metricContainerFieldName = "metricContainer";
FlinkMetricContainer monitoredContainer = Mockito.spy((FlinkMetricContainer) Whitebox.getInternalState(doFnFunction, metricContainerFieldName));
Whitebox.setInternalState(doFnFunction, metricContainerFieldName, monitoredContainer);
doFnFunction.close();
Mockito.verify(monitoredContainer).registerMetricsForPipelineResult();
}
Aggregations