Class PropertiesFile


  • public class PropertiesFile
    extends Object
    • Constructor Detail

      • PropertiesFile

        public PropertiesFile()
        Basic constructor for testing purposes.
      • PropertiesFile

        public PropertiesFile​(File propertiesFile)
                       throws org.apache.maven.plugin.MojoExecutionException
        Create a new PropertiesFiles object from a properties file
        Parameters:
        propertiesFile - The file to use to create a PropertiesFiles object
        Throws:
        org.apache.maven.plugin.MojoExecutionException - MojoExecutionException
      • PropertiesFile

        public PropertiesFile​(org.eclipse.aether.artifact.Artifact jmeterConfigArtifact,
                              ConfigurationFiles jMeterPropertiesFile)
                       throws org.apache.maven.plugin.MojoExecutionException
        Create a new PropertiesFiles object from a properties file held in the jMeterConfigArtifact
        Parameters:
        jmeterConfigArtifact - The artifact to try and find the properties file in
        jMeterPropertiesFile - The properties file that we want to find in the jmeterConfigArtifact
        Throws:
        org.apache.maven.plugin.MojoExecutionException - MojoExecutionException
    • Method Detail

      • loadProvidedPropertiesIfAvailable

        public void loadProvidedPropertiesIfAvailable​(File providedPropertiesFile,
                                                      boolean replaceAllProperties)
                                               throws org.apache.maven.plugin.MojoExecutionException
        Check if a file exists. If it does calculate if we need to merge it with existing properties, or replace all existing properties.
        Parameters:
        providedPropertiesFile - A properties file that will be check to see if it exists
        replaceAllProperties - If we should replace all properties, or just merge them
        Throws:
        org.apache.maven.plugin.MojoExecutionException - MojoExecutionException
      • addAndOverwriteProperties

        public void addAndOverwriteProperties​(Map<String,​String> additionalProperties)
        Merge a Map of properties into our Properties object The additions will overwrite any existing properties
        Parameters:
        additionalProperties - Map to merge into our Properties object
      • writePropertiesToFile

        public void writePropertiesToFile​(File outputFile)
                                   throws org.apache.maven.plugin.MojoExecutionException
        Strip out any reserved properties and then write properties object to a file.
        Parameters:
        outputFile - The file that our properties object will be written to
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • stripOutReservedProperties

        protected void stripOutReservedProperties()
        This will strip all reserved properties from a Properties object. (Used to ensure that restricted properties haven't been set in custom properties files)
      • getProperties

        public Properties getProperties()
        A getter used for testing purposes
        Returns:
        this.properties