Class TestEnvironment


  • public class TestEnvironment
    extends org.apache.flink.api.java.ExecutionEnvironment
    A ExecutionEnvironment implementation which executes its jobs on a MiniCluster.
    • Field Summary

      • Fields inherited from class org.apache.flink.api.java.ExecutionEnvironment

        lastJobExecutionResult, LOG
    • Constructor Summary

      Constructors 
      Constructor Description
      TestEnvironment​(org.apache.flink.runtime.minicluster.MiniCluster executor, int parallelism, boolean isObjectReuseEnabled)  
      TestEnvironment​(org.apache.flink.runtime.minicluster.MiniCluster miniCluster, int parallelism, boolean isObjectReuseEnabled, Collection<org.apache.flink.core.fs.Path> jarFiles, Collection<URL> classPaths)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.flink.api.common.JobExecutionResult getLastJobExecutionResult()  
      void setAsContext()  
      static void setAsContext​(org.apache.flink.runtime.minicluster.MiniCluster miniCluster, int parallelism)
      Sets the current ExecutionEnvironment to be a TestEnvironment.
      static void setAsContext​(org.apache.flink.runtime.minicluster.MiniCluster miniCluster, int parallelism, Collection<org.apache.flink.core.fs.Path> jarFiles, Collection<URL> classPaths)
      Sets the current ExecutionEnvironment to be a TestEnvironment.
      static void unsetAsContext()  
      • Methods inherited from class org.apache.flink.api.java.ExecutionEnvironment

        addDefaultKryoSerializer, addDefaultKryoSerializer, areExplicitEnvironmentsAllowed, clearJobListeners, configure, createCollectionsEnvironment, createInput, createInput, createLocalEnvironment, createLocalEnvironment, createLocalEnvironment, createLocalEnvironmentWithWebUI, createProgramPlan, createProgramPlan, createProgramPlan, createRemoteEnvironment, createRemoteEnvironment, createRemoteEnvironment, execute, execute, executeAsync, executeAsync, fromCollection, fromCollection, fromCollection, fromCollection, fromElements, fromElements, fromParallelCollection, fromParallelCollection, generateSequence, getConfig, getConfiguration, getDefaultLocalParallelism, getExecutionEnvironment, getExecutionPlan, getExecutorServiceLoader, getJobListeners, getNumberOfExecutionRetries, getParallelism, getRestartStrategy, getUserCodeClassLoader, initializeContextEnvironment, readCsvFile, readFile, readFileOfPrimitives, readFileOfPrimitives, readTextFile, readTextFile, readTextFileWithValue, readTextFileWithValue, registerCachedFile, registerCachedFile, registerJobListener, registerType, registerTypeWithKryoSerializer, registerTypeWithKryoSerializer, resetContextEnvironment, setDefaultLocalParallelism, setNumberOfExecutionRetries, setParallelism, setRestartStrategy
    • Constructor Detail

      • TestEnvironment

        public TestEnvironment​(org.apache.flink.runtime.minicluster.MiniCluster miniCluster,
                               int parallelism,
                               boolean isObjectReuseEnabled,
                               Collection<org.apache.flink.core.fs.Path> jarFiles,
                               Collection<URL> classPaths)
      • TestEnvironment

        public TestEnvironment​(org.apache.flink.runtime.minicluster.MiniCluster executor,
                               int parallelism,
                               boolean isObjectReuseEnabled)
    • Method Detail

      • getLastJobExecutionResult

        public org.apache.flink.api.common.JobExecutionResult getLastJobExecutionResult()
        Overrides:
        getLastJobExecutionResult in class org.apache.flink.api.java.ExecutionEnvironment
      • setAsContext

        public void setAsContext()
      • setAsContext

        public static void setAsContext​(org.apache.flink.runtime.minicluster.MiniCluster miniCluster,
                                        int parallelism,
                                        Collection<org.apache.flink.core.fs.Path> jarFiles,
                                        Collection<URL> classPaths)
        Sets the current ExecutionEnvironment to be a TestEnvironment. The test environment executes the given jobs on a Flink mini cluster with the given default parallelism and the additional jar files and class paths.
        Parameters:
        miniCluster - The MiniCluster to execute jobs on.
        parallelism - The default parallelism
        jarFiles - Additional jar files to execute the job with
        classPaths - Additional class paths to execute the job with
      • setAsContext

        public static void setAsContext​(org.apache.flink.runtime.minicluster.MiniCluster miniCluster,
                                        int parallelism)
        Sets the current ExecutionEnvironment to be a TestEnvironment. The test environment executes the given jobs on a Flink mini cluster with the given default parallelism and the additional jar files and class paths.
        Parameters:
        miniCluster - The MiniCluster to execute jobs on.
        parallelism - The default parallelism
      • unsetAsContext

        public static void unsetAsContext()