Class AbstractNodeWrapper

java.lang.Object
org.apache.iotdb.it.env.cluster.node.AbstractNodeWrapper
All Implemented Interfaces:
BaseNodeWrapper
Direct Known Subclasses:
AINodeWrapper, ConfigNodeWrapper, DataNodeWrapper

public abstract class AbstractNodeWrapper extends Object implements BaseNodeWrapper
  • Field Details

    • testClassName

      protected final String testClassName
    • testMethodName

      protected final String testMethodName
    • portList

      protected final int[] portList
    • jmxPort

      protected final int jmxPort
    • jvmConfig

      protected final MppJVMConfig jvmConfig
    • clusterIndex

      protected final int clusterIndex
    • isMultiCluster

      protected final boolean isMultiCluster
    • instance

      protected Process instance
    • mutableNodeProperties

      protected final Properties mutableNodeProperties
      Mutable properties are always hardcoded default values to make the cluster be set up successfully. Their lifecycles are the same with the whole test runner.
    • mutableCommonProperties

      protected final Properties mutableCommonProperties
    • clusterConfigProperties

      protected final Properties clusterConfigProperties
      Specified by -DClusterConfigurations in commandLine. A name of ClusterConfigurations can be interpreted to a set of configurations below.
    • immutableNodeProperties

      protected final Properties immutableNodeProperties
      Immutable values are connection configurations, such as ip, ports which are generated randomly during cluster initialization. Their lifecycles are the same with this node wrapper instance.
    • immutableCommonProperties

      protected final Properties immutableCommonProperties
    • outputCommonConfig

      protected final MppCommonConfig outputCommonConfig
  • Constructor Details

    • AbstractNodeWrapper

      protected AbstractNodeWrapper(String testClassName, String testMethodName, int[] portList, int clusterIndex, boolean isMultiCluster, long startTime)
  • Method Details

    • createNodeDir

      public void createNodeDir()
      CreateNodeDir must be called before changeConfig for persistent.
      Specified by:
      createNodeDir in interface BaseNodeWrapper
    • createLogDir

      public void createLogDir()
      CreateLogDir must be called after changeConfig for correct log directory.
      Specified by:
      createLogDir in interface BaseNodeWrapper
    • destroyDir

      public void destroyDir()
      Specified by:
      destroyDir in interface BaseNodeWrapper
    • changeConfig

      public final void changeConfig(MppBaseConfig nodeConfig, MppCommonConfig commonConfig, @Nullable MppJVMConfig jvmConfig)
      Change the config of this node. Here's the order of applied config source. The latter one will override the former one if a key is duplicated.
      • 1. Reading directly from assembled property files of other modules.
      • 2. Default values which are hardcoded in mutable properties fields.
      • 3. Values read from the path specified by system variables.
      • 4. Values mutated by developers through EnvFactory.
      • 5. Make sure immutable properties are not changed.
      Parameters:
      nodeConfig - the values mutated through EnvFactory
      commonConfig - the values mutated through EnvFactory.
      jvmConfig - the JVM configurations need to be changed. If it's null, then nothing will be happened.
    • start

      public void start()
      Specified by:
      start in interface BaseNodeWrapper
    • stop

      public void stop()
      Specified by:
      stop in interface BaseNodeWrapper
    • stopForcibly

      public void stopForcibly()
      Specified by:
      stopForcibly in interface BaseNodeWrapper
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface BaseNodeWrapper
    • getIp

      public final String getIp()
      Specified by:
      getIp in interface BaseNodeWrapper
    • getPort

      public final int getPort()
      Specified by:
      getPort in interface BaseNodeWrapper
    • getMetricPort

      public int getMetricPort()
      Specified by:
      getMetricPort in interface BaseNodeWrapper
    • setPort

      public void setPort(int port)
    • getIpAndPortString

      public final String getIpAndPortString()
      Specified by:
      getIpAndPortString in interface BaseNodeWrapper
    • workDirFilePath

      protected String workDirFilePath(String dirName, String fileName)
    • getLogPath

      protected String getLogPath()
    • getLogDirPath

      public String getLogDirPath()
    • getNodePath

      public String getNodePath()
    • getDataPath

      public String getDataPath()
    • dumpJVMSnapshot

      public void dumpJVMSnapshot(String testCaseName)
    • getTestLogDirName

      protected String getTestLogDirName()
    • setKillPoints

      public void setKillPoints(List<String> killPoints)
    • reloadMutableFields

      protected abstract void reloadMutableFields()
    • renameFile

      protected abstract void renameFile()
    • getSystemConfigPath

      protected abstract String getSystemConfigPath()
    • getDefaultNodeConfigPath

      protected abstract String getDefaultNodeConfigPath()
      Return the node config file path specified through system variable
    • getDefaultCommonConfigPath

      protected abstract String getDefaultCommonConfigPath()
      Return the common config file path specified through system variable
    • addStartCmdParams

      protected abstract void addStartCmdParams(List<String> params)
    • getSystemPropertiesPath

      public abstract String getSystemPropertiesPath()
    • initVMConfig

      protected abstract MppJVMConfig initVMConfig()
    • executeJstack

      public void executeJstack()
      Description copied from interface: BaseNodeWrapper
      Perform jstack on the process corresponding to the wrapper, and use logger to output the results.
      Specified by:
      executeJstack in interface BaseNodeWrapper
    • executeJstack

      public void executeJstack(String testCaseName)
      Description copied from interface: BaseNodeWrapper
      Perform jstack on the process corresponding to the wrapper, and output the results to a file in the log directory.
      Specified by:
      executeJstack in interface BaseNodeWrapper
      Parameters:
      testCaseName - the name of test case
    • getPid

      public long getPid()
      Specified by:
      getPid in interface BaseNodeWrapper
      Returns:
      The native process ID of the process, -1 if failure.