public class CollectionTestEnvironment extends CollectionEnvironment
CollectionEnvironment
to be used in tests. The predominant feature of this class is
that it allows setting it as a context environment, causing it to be returned by ExecutionEnvironment.getExecutionEnvironment()
. This also allows retrieving the JobExecutionResult
outside the actual program.lastJobExecutionResult, LOG
Constructor and Description |
---|
CollectionTestEnvironment() |
Modifier and Type | Method and Description |
---|---|
JobExecutionResult |
execute(String jobName)
Triggers the program execution.
|
JobExecutionResult |
getLastJobExecutionResult()
Returns the
JobExecutionResult of the last executed job. |
protected void |
setAsContext() |
protected static void |
unsetAsContext() |
getParallelism
addDefaultKryoSerializer, addDefaultKryoSerializer, areExplicitEnvironmentsAllowed, clearJobListeners, configure, createCollectionsEnvironment, createInput, createInput, createLocalEnvironment, createLocalEnvironment, createLocalEnvironment, createLocalEnvironmentWithWebUI, createProgramPlan, createProgramPlan, createProgramPlan, createRemoteEnvironment, createRemoteEnvironment, createRemoteEnvironment, execute, executeAsync, executeAsync, fromCollection, fromCollection, fromCollection, fromCollection, fromElements, fromElements, fromParallelCollection, fromParallelCollection, generateSequence, getConfig, getConfiguration, getDefaultLocalParallelism, getExecutionEnvironment, getExecutionPlan, getExecutorServiceLoader, getJobListeners, getNumberOfExecutionRetries, getRestartStrategy, getUserCodeClassLoader, initializeContextEnvironment, readCsvFile, readFile, readFileOfPrimitives, readFileOfPrimitives, readTextFile, readTextFile, readTextFileWithValue, readTextFileWithValue, registerCachedFile, registerCachedFile, registerJobListener, registerType, registerTypeWithKryoSerializer, registerTypeWithKryoSerializer, resetContextEnvironment, setDefaultLocalParallelism, setNumberOfExecutionRetries, setParallelism, setRestartStrategy
public JobExecutionResult getLastJobExecutionResult()
ExecutionEnvironment
JobExecutionResult
of the last executed job.getLastJobExecutionResult
in class ExecutionEnvironment
public JobExecutionResult execute(String jobName) throws Exception
ExecutionEnvironment
DataSet.print()
, writing results (e.g. DataSet.writeAsText(String)
, DataSet.write(org.apache.flink.api.common.io.FileOutputFormat, String)
, or other generic
data sinks created with DataSet.output(org.apache.flink.api.common.io.OutputFormat)
.
The program execution will be logged and displayed with the given job name.
execute
in class CollectionEnvironment
Exception
- Thrown, if the program executions fails.protected void setAsContext()
protected static void unsetAsContext()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.