Package org.apache.flink.test.util
Class MultipleProgramsTestBase
- java.lang.Object
-
- org.apache.flink.test.util.AbstractTestBase
-
- org.apache.flink.test.util.MultipleProgramsTestBase
-
public class MultipleProgramsTestBase extends AbstractTestBase
Base class for unit tests that run multiple tests and want to reuse the same Flink cluster. This saves a significant amount of time, since the startup and shutdown of the Flink clusters (including actor systems, etc) usually dominates the execution of the actual tests.To write a unit test against this test base, simply extend it and add one or more regular test methods and retrieve the ExecutionEnvironment from the context:
{@literal @}Test public void someTest() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); // test code env.execute(); } {@literal @}Test public void anotherTest() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); // test code env.execute(); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultipleProgramsTestBase.TestExecutionMode
Enum that defines which execution environment to run the next test on: An embedded local flink cluster, or the collection execution backend.
-
Field Summary
Fields Modifier and Type Field Description protected MultipleProgramsTestBase.TestExecutionMode
mode
-
Fields inherited from class org.apache.flink.test.util.AbstractTestBase
MINI_CLUSTER_EXTENSION, temporaryFolder
-
-
Constructor Summary
Constructors Constructor Description MultipleProgramsTestBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Collection<MultipleProgramsTestBase.TestExecutionMode>
executionModes()
void
setupEnvironment()
void
teardownEnvironment()
-
Methods inherited from class org.apache.flink.test.util.AbstractTestBase
cleanupRunningJobs, createAndRegisterTempFile, createTempFile, getTempDirPath, getTempFilePath
-
-
-
-
Field Detail
-
mode
protected MultipleProgramsTestBase.TestExecutionMode mode
-
-
Method Detail
-
setupEnvironment
@BeforeEach public void setupEnvironment()
-
teardownEnvironment
@AfterEach public void teardownEnvironment()
-
executionModes
public static Collection<MultipleProgramsTestBase.TestExecutionMode> executionModes()
-
-