Class LocalStandaloneFlinkResource
- java.lang.Object
-
- org.apache.flink.tests.util.flink.LocalStandaloneFlinkResource
-
- All Implemented Interfaces:
FlinkResource
,ExternalResource
,org.junit.rules.TestRule
public class LocalStandaloneFlinkResource extends Object implements FlinkResource
Flink resource that start local standalone clusters.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterTestFailure()
void
afterTestSuccess()
void
before()
Stream<String>
searchAllLogs(Pattern pattern, Function<Matcher,String> matchProcessor)
Searches the logs of all processes for the given pattern, and applies the given processor for every line for whichMatcher.matches()
returned true.ClusterController
startCluster(int numTaskManagers)
Starts a cluster.GatewayController
startSqlGateway()
Starts a sqlserver and returns theGatewayController
which can be used to shut down the process.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.util.ExternalResource
apply
-
-
-
-
Method Detail
-
before
public void before() throws Exception
- Specified by:
before
in interfaceExternalResource
- Throws:
Exception
-
afterTestSuccess
public void afterTestSuccess()
- Specified by:
afterTestSuccess
in interfaceExternalResource
-
afterTestFailure
public void afterTestFailure()
- Specified by:
afterTestFailure
in interfaceExternalResource
-
startCluster
public ClusterController startCluster(int numTaskManagers) throws IOException
Description copied from interface:FlinkResource
Starts a cluster.The exact constellation of the cluster is undefined.
In the case of per-job clusters this method may not start any Flink processes, deferring this to
ClusterController.submitJob(JobSubmission, Duration)
.- Specified by:
startCluster
in interfaceFlinkResource
- Parameters:
numTaskManagers
- number of task managers- Returns:
- controller for interacting with the cluster
- Throws:
IOException
-
startSqlGateway
public GatewayController startSqlGateway() throws IOException
Description copied from interface:FlinkResource
Starts a sqlserver and returns theGatewayController
which can be used to shut down the process.- Specified by:
startSqlGateway
in interfaceFlinkResource
- Returns:
- controller for interacting with the cluster
- Throws:
IOException
-
searchAllLogs
public Stream<String> searchAllLogs(Pattern pattern, Function<Matcher,String> matchProcessor) throws IOException
Description copied from interface:FlinkResource
Searches the logs of all processes for the given pattern, and applies the given processor for every line for whichMatcher.matches()
returned true.- Specified by:
searchAllLogs
in interfaceFlinkResource
- Parameters:
pattern
- pattern to search formatchProcessor
- match processor- Returns:
- stream of matched strings
- Throws:
IOException
-
-