Search in sources :

Example 1 with TestJobClient

use of org.apache.flink.streaming.api.operators.collect.utils.TestJobClient in project flink by apache.

the class CollectResultIteratorTest method createIteratorAndJobClient.

private Tuple2<CollectResultIterator<Integer>, JobClient> createIteratorAndJobClient(AbstractCollectResultBuffer<Integer> buffer, AbstractTestCoordinationRequestHandler<Integer> handler) {
    CollectResultIterator<Integer> iterator = new CollectResultIterator<>(buffer, CompletableFuture.completedFuture(TEST_OPERATOR_ID), ACCUMULATOR_NAME, 0);
    TestJobClient.JobInfoProvider infoProvider = new TestJobClient.JobInfoProvider() {

        @Override
        public boolean isJobFinished() {
            return handler.isClosed();
        }

        @Override
        public Map<String, OptionalFailure<Object>> getAccumulatorResults() {
            return handler.getAccumulatorResults();
        }
    };
    TestJobClient jobClient = new TestJobClient(TEST_JOB_ID, TEST_OPERATOR_ID, handler, infoProvider);
    iterator.setJobClient(jobClient);
    return Tuple2.of(iterator, jobClient);
}
Also used : OptionalFailure(org.apache.flink.util.OptionalFailure) TestJobClient(org.apache.flink.streaming.api.operators.collect.utils.TestJobClient)

Aggregations

TestJobClient (org.apache.flink.streaming.api.operators.collect.utils.TestJobClient)1 OptionalFailure (org.apache.flink.util.OptionalFailure)1