Package com.lazerycode.jmeter.properties
Class PropertiesFile
- java.lang.Object
-
- com.lazerycode.jmeter.properties.PropertiesFile
-
public class PropertiesFile extends Object
-
-
Constructor Summary
Constructors Constructor Description PropertiesFile()
Basic constructor for testing purposes.PropertiesFile(File propertiesFile)
Create a new PropertiesFiles object from a properties filePropertiesFile(org.eclipse.aether.artifact.Artifact jmeterConfigArtifact, ConfigurationFiles jMeterPropertiesFile)
Create a new PropertiesFiles object from a properties file held in the jMeterConfigArtifact
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAndOverwriteProperties(Map<String,String> additionalProperties)
Merge a Map of properties into our Properties object The additions will overwrite any existing propertiesProperties
getProperties()
A getter used for testing purposesvoid
loadProvidedPropertiesIfAvailable(File providedPropertiesFile, boolean replaceAllProperties)
Check if a file exists.protected void
stripOutReservedProperties()
This will strip all reserved properties from a Properties object.void
writePropertiesToFile(File outputFile)
Strip out any reserved properties and then write properties object to a file.
-
-
-
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 injMeterPropertiesFile
- 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 existsreplaceAllProperties
- 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
-
-