Package dataProviders

Class ConfigFileReader

java.lang.Object
dataProviders.ConfigFileReader

public class ConfigFileReader extends Object
The ConfigFileReader class is responsible for reading and retrieving configuration properties from the Configuration.properties file. It provides methods to access various configuration settings used in the Pacman project.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a ConfigFileReader object and loads the properties from the configuration file.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Retrieves the flag indicating whether to clean the directories specified in the configuration file.
    boolean
    Retrieves the flag indicating whether to combine the custom maps and sequences in the configuration file.
    int
    Retrieves the number indicating the custom maps type we should generate in this run.
    int
    Retrieves the number indicating the custom sequences type we should generate in this run.
    long
    Retrieves the timeout for each iteration in milliseconds, as specified in the configuration file.
    Retrieves the name of the CSV log file specified in the configuration file.
    Retrieves the directory path for storing the log files.
    Retrieves the name of the log file specified in the configuration file.
    boolean
    Retrieves the flag indicating whether to log the history of actions specified in the configuration file.
    Retrieves the map file type specified in the configuration file.
    Retrieves the directory path for storing the map files.
    int
    Retrieves the maximum length of an action sequence specified in the configuration file.
    int
    Retrieves the maximum size of a binary map specified in the configuration file.
    boolean
    Retrieves the flag indicating whether the max number of iterations should be ignored, and the number of custom maps or sequences should be used instead.
    int
    Retrieves the maximum number of iterations specified in the configuration file.
    int
    Retrieves the maximum height of a text-based map specified in the configuration file.
    int
    Retrieves the maximum width of a text-based map specified in the configuration file.
    long
    Retrieves the maximum time specified in the configuration file.
    Retrieves the resulting directory path where all the output files and directories will be stored.
    void
    Write a configs.js file in the configs directory with the basePath variable set to the current project directory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfigFileReader

      public ConfigFileReader()
      Constructs a ConfigFileReader object and loads the properties from the configuration file. If the configuration file is not found, a RuntimeException is thrown.
  • Method Details

    • getMapFilesType

      public MapFileType getMapFilesType()
      Retrieves the map file type specified in the configuration file.
      Returns:
      The map file type (TEXT, BINARY, or ALL).
    • getLogFileName

      public String getLogFileName()
      Retrieves the name of the log file specified in the configuration file. If the name is not specified or empty, it returns the default log file name.
      Returns:
      The name of the log file.
    • getLogCSVFileName

      public String getLogCSVFileName()
      Retrieves the name of the CSV log file specified in the configuration file. Same as text, but different extension.
      Returns:
      The name of the CSV log file.
    • getLogFileDirectoryPath

      public String getLogFileDirectoryPath()
      Retrieves the directory path for storing the log files. If the path is not specified, it returns the default log directory name within the resulting directory path.
      Returns:
      The directory path for storing the log files.
    • getMapsFileDirectoryPath

      public String getMapsFileDirectoryPath()
      Retrieves the directory path for storing the map files. If the path is not specified, it returns the default map directory name within the resulting directory path.
      Returns:
      The directory path for storing the map files.
    • getResultingDirectoryPath

      public String getResultingDirectoryPath()
      Retrieves the resulting directory path where all the output files and directories will be stored. If the path is not specified, it returns the default resulting directory name within the project root directory.
      Returns:
      The resulting directory path.
    • getMaxIterations

      public int getMaxIterations()
      Retrieves the maximum number of iterations specified in the configuration file. If the maximum iterations property is not found or cannot be parsed as an integer, it returns a default value of 100.
      Returns:
      The maximum number of iterations.
    • getMaxCustomIterations

      public boolean getMaxCustomIterations()
      Retrieves the flag indicating whether the max number of iterations should be ignored, and the number of custom maps or sequences should be used instead. If the max iterations property is not found or cannot be parsed as a boolean, it returns a default value of false.
      Returns:
      The flag indicating whether the max number of iterations should be ignored.
    • getMaxTime

      public long getMaxTime()
      Retrieves the maximum time specified in the configuration file. If the maximum time property is not found or cannot be parsed as a long, it returns a default value of 900000 (15 minutes).
      Returns:
      The maximum time in milliseconds.
    • getMaxTextMapHeight

      public int getMaxTextMapHeight()
      Retrieves the maximum height of a text-based map specified in the configuration file. If the maximum height property is not found or cannot be parsed as an integer, it returns a default value of 20.
      Returns:
      The maximum height of a text-based map.
    • getMaxTextMapWidth

      public int getMaxTextMapWidth()
      Retrieves the maximum width of a text-based map specified in the configuration file. If the maximum width property is not found or cannot be parsed as an integer, it returns a default value of 20.
      Returns:
      The maximum width of a text-based map.
    • getMaxBinaryMapSize

      public int getMaxBinaryMapSize()
      Retrieves the maximum size of a binary map specified in the configuration file. If the maximum size property is not found or cannot be parsed as an integer, it returns a default value of 1000.
      Returns:
      The maximum size of a binary map.
    • getMaxActionSequenceLength

      public int getMaxActionSequenceLength()
      Retrieves the maximum length of an action sequence specified in the configuration file. If the maximum length property is not found or cannot be parsed as an integer, it returns a default value of 5.
      Returns:
      The maximum length of an action sequence.
    • getCleanDirectories

      public boolean getCleanDirectories()
      Retrieves the flag indicating whether to clean the directories specified in the configuration file. If the clean directories property is not found or cannot be parsed as a boolean, it returns false.
      Returns:
      true if the directories should be cleaned, false otherwise.
    • getLogHistory

      public boolean getLogHistory()
      Retrieves the flag indicating whether to log the history of actions specified in the configuration file. If the log history property is not found or cannot be parsed as a boolean, it returns true.
      Returns:
      true if the history should be logged, false otherwise.
    • getCustomMapsNr

      public int getCustomMapsNr()
      Retrieves the number indicating the custom maps type we should generate in this run. If the custom maps type property is not found or cannot be parsed as an integer, it returns 0.
      Returns:
      Custom maps type.
    • getCustomSequenceNr

      public int getCustomSequenceNr()
      Retrieves the number indicating the custom sequences type we should generate in this run. If the custom sequences type property is not found or cannot be parsed as an integer, it returns 0.
      Returns:
      Custom sequences type.
    • getCombinedCustomMapsAndSequences

      public boolean getCombinedCustomMapsAndSequences()
      Retrieves the flag indicating whether to combine the custom maps and sequences in the configuration file. If the clean directories property is not found or cannot be parsed as a boolean, it returns false.
      Returns:
      true if every unique combination of the custom maps and sequences should be fuzzed, false otherwise.
    • writeConfigFile

      public void writeConfigFile()
      Write a configs.js file in the configs directory with the basePath variable set to the current project directory. This file is used by the fuzzer to write the HTML reports with the correct base path.
    • getIterationTimeout

      public long getIterationTimeout()
      Retrieves the timeout for each iteration in milliseconds, as specified in the configuration file. If the timeout property is not found or cannot be parsed as a long, it returns a default value of 60000.
      Returns:
      The timeout for each iteration in milliseconds.