Package org.apache.iotdb.itbase.env
Interface BaseEnv
- All Known Implementing Classes:
AbstractEnv,AIEnv,Cluster1Env,MultiClusterEnv,RemoteServerEnv,SimpleEnv
public interface BaseEnv
-
Method Summary
Modifier and TypeMethodDescriptionvoidDestroy the cluster and all the configurations.dataNodeIdToWrapper(int nodeId) voidvoidensureNodeStatus(List<BaseNodeWrapper> nodes, List<NodeStatus> targetStatus) Ensure all the nodes being in the corresponding status.Get aConfigNodeWrapperrandomly.Get aDataNodeWrapperrandomly.Return theClusterConfigfor developers to set values before test.default IConfigNodeRPCService.IfacegetConfigNodeConnection(int index) getConfigNodeWrapper(int index) Get theConfigNodeWrapperof the specified index.default ConnectiongetConnection(String username, String password) getConnection(DataNodeWrapper dataNodeWrapper, String username, String password) default ConnectiongetConnection(Constant.Version version) getConnection(Constant.Version version, String username, String password) default ConnectiongetConnectionWithSpecifiedDataNode(DataNodeWrapper dataNode, String username, String password) getDataNodeWrapper(int index) Get theDataNodeWrapperof the specified index.intGet the index of the first dataNode with a SchemaRegion leader.getIP()intGet the index of the ConfigNode leader.getMetricPrometheusReporterContents(String authHeader) Return the content of prometheusintgetPort()getSessionConnection(String userName, String password) getSessionConnection(ZoneId zoneId) getSessionConnection(List<String> nodeUrls) getSessionPool(int maxSize) default StringgetUrlContent(String urlStr, String authHeader) default ConnectiongetWriteOnlyConnectionWithSpecifiedDataNode(DataNodeWrapper dataNode, String username, String password) voidInit a cluster with default number of ConfigNodes and DataNodes.voidinitClusterEnvironment(int configNodesNum, int dataNodesNum) Init a cluster with the specified number of ConfigNodes and DataNodes.voidinitClusterEnvironment(int configNodesNum, int dataNodesNum, int testWorkingRetryCount) Init a cluster with the specified number of ConfigNodes and DataNodes.voidregisterConfigNodeKillPoints(List<String> killPoints) voidregisterDataNodeKillPoints(List<String> killPoints) voidregisterNewConfigNode(boolean isNeedVerify) Register a new ConfigNode with random ports.voidregisterNewConfigNode(ConfigNodeWrapper newConfigNodeWrapper, boolean isNeedVerify) Register a new DataNode with specified ConfigNodeWrapper.voidregisterNewDataNode(boolean isNeedVerify) Register a new DataNode with random ports.voidregisterNewDataNode(DataNodeWrapper newDataNodeWrapper, boolean isNeedVerify) Register a new DataNode with specified DataNodeWrapper.voidsetTestMethodName(String testCaseName) voidShutdown all existed ConfigNodes.voidShutdown all existed DataNodes.voidshutdownConfigNode(int index) Shutdown an existed ConfigNode.voidshutdownDataNode(int index) Shutdown an existed DataNode.voidvoidShutdown forcibly all existed DataNodes.voidStart all existed ConfigNodes.voidStart all existed DataNodes.voidstartConfigNode(int index) Start an existed ConfigNode.voidstartDataNode(int index) Start an existed DataNode.
-
Method Details
-
initClusterEnvironment
void initClusterEnvironment()Init a cluster with default number of ConfigNodes and DataNodes. -
initClusterEnvironment
void initClusterEnvironment(int configNodesNum, int dataNodesNum) Init a cluster with the specified number of ConfigNodes and DataNodes.- Parameters:
configNodesNum- the number of ConfigNodes.dataNodesNum- the number of DataNodes.
-
initClusterEnvironment
void initClusterEnvironment(int configNodesNum, int dataNodesNum, int testWorkingRetryCount) Init a cluster with the specified number of ConfigNodes and DataNodes.- Parameters:
configNodesNum- the number of ConfigNodes.dataNodesNum- the number of DataNodes.testWorkingRetryCount- the retry count when testing the availability of cluster
-
cleanClusterEnvironment
void cleanClusterEnvironment()Destroy the cluster and all the configurations. -
getConfig
ClusterConfig getConfig()Return theClusterConfigfor developers to set values before test. -
getUrlContent
-
getMetricPrometheusReporterContents
Return the content of prometheus -
getConnection
- Throws:
SQLException
-
getConnection
- Throws:
SQLException
-
getConnection
Connection getConnection(Constant.Version version, String username, String password) throws SQLException - Throws:
SQLException
-
getConnection
- Throws:
SQLException
-
getConnection
Connection getConnection(DataNodeWrapper dataNodeWrapper, String username, String password) throws SQLException - Throws:
SQLException
-
getWriteOnlyConnectionWithSpecifiedDataNode
default Connection getWriteOnlyConnectionWithSpecifiedDataNode(DataNodeWrapper dataNode) throws SQLException - Throws:
SQLException
-
getWriteOnlyConnectionWithSpecifiedDataNode
Connection getWriteOnlyConnectionWithSpecifiedDataNode(DataNodeWrapper dataNode, String username, String password) throws SQLException - Throws:
SQLException
-
getConnectionWithSpecifiedDataNode
- Throws:
SQLException
-
getConnectionWithSpecifiedDataNode
Connection getConnectionWithSpecifiedDataNode(DataNodeWrapper dataNode, String username, String password) throws SQLException - Throws:
SQLException
-
setTestMethodName
-
dumpTestJVMSnapshot
void dumpTestJVMSnapshot() -
getNodeWrapperList
List<AbstractNodeWrapper> getNodeWrapperList() -
getConfigNodeWrapperList
List<ConfigNodeWrapper> getConfigNodeWrapperList() -
getDataNodeWrapperList
List<DataNodeWrapper> getDataNodeWrapperList() -
getLeaderConfigNodeConnection
IConfigNodeRPCService.Iface getLeaderConfigNodeConnection() throws ClientManagerException, IOException, InterruptedException -
getSessionPool
-
getSessionConnection
- Throws:
IoTDBConnectionException
-
getSessionConnection
- Throws:
IoTDBConnectionException
-
getSessionConnection
- Throws:
IoTDBConnectionException
-
getSessionConnection
- Throws:
IoTDBConnectionException
-
getFirstLeaderSchemaRegionDataNodeIndex
Get the index of the first dataNode with a SchemaRegion leader.- Returns:
- The index of DataNode with SchemaRegion-leader in dataNodeWrapperList
- Throws:
IOExceptionInterruptedException
-
getLeaderConfigNodeIndex
Get the index of the ConfigNode leader.- Returns:
- The index of ConfigNode-Leader in configNodeWrapperList
- Throws:
IOExceptionInterruptedException
-
getConfigNodeConnection
- Throws:
Exception
-
startConfigNode
void startConfigNode(int index) Start an existed ConfigNode. -
startAllConfigNodes
void startAllConfigNodes()Start all existed ConfigNodes. -
shutdownConfigNode
void shutdownConfigNode(int index) Shutdown an existed ConfigNode. -
shutdownAllConfigNodes
void shutdownAllConfigNodes()Shutdown all existed ConfigNodes. -
shutdownForciblyAllConfigNodes
void shutdownForciblyAllConfigNodes() -
ensureNodeStatus
void ensureNodeStatus(List<BaseNodeWrapper> nodes, List<NodeStatus> targetStatus) throws IllegalStateException Ensure all the nodes being in the corresponding status.- Parameters:
nodes- the nodes list to query.targetStatus- the targetNodeStatusof each node. It should have the same length with nodes.- Throws:
IllegalStateException- if there are some nodes not in the targetStatus after a period times of check.
-
getConfigNodeWrapper
Get theConfigNodeWrapperof the specified index.- Returns:
- The ConfigNodeWrapper of the specified index
-
getDataNodeWrapper
Get theDataNodeWrapperof the specified index.- Returns:
- The DataNodeWrapper of the specified index
-
generateRandomConfigNodeWrapper
ConfigNodeWrapper generateRandomConfigNodeWrapper()Get aConfigNodeWrapperrandomly.- Returns:
- A random available ConfigNodeWrapper
-
generateRandomDataNodeWrapper
DataNodeWrapper generateRandomDataNodeWrapper()Get aDataNodeWrapperrandomly.- Returns:
- A random available ConfigNodeWrapper
-
registerNewDataNode
void registerNewDataNode(boolean isNeedVerify) Register a new DataNode with random ports. -
registerNewDataNode
Register a new DataNode with specified DataNodeWrapper. -
registerNewConfigNode
void registerNewConfigNode(boolean isNeedVerify) Register a new ConfigNode with random ports. -
registerNewConfigNode
Register a new DataNode with specified ConfigNodeWrapper. -
startDataNode
void startDataNode(int index) Start an existed DataNode. -
startAllDataNodes
void startAllDataNodes()Start all existed DataNodes. -
shutdownDataNode
void shutdownDataNode(int index) Shutdown an existed DataNode. -
shutdownAllDataNodes
void shutdownAllDataNodes()Shutdown all existed DataNodes. -
shutdownForciblyAllDataNodes
void shutdownForciblyAllDataNodes()Shutdown forcibly all existed DataNodes. -
getMqttPort
int getMqttPort() -
getIP
String getIP() -
getPort
String getPort() -
getSbinPath
String getSbinPath() -
getToolsPath
String getToolsPath() -
getLibPath
String getLibPath() -
dataNodeIdToWrapper
-
registerConfigNodeKillPoints
-
registerDataNodeKillPoints
-