* @return created {@link GrinderProperties} instance
*/
public GrinderProperties getGrinderProperties(PerfTest perfTest, ScriptHandler scriptHandler) {
try {
// Use default properties first
GrinderProperties grinderProperties = new GrinderProperties(config.getHome().getDefaultGrinderProperties());
User user = perfTest.getCreatedUser();
// Get all files in the script path
String scriptName = perfTest.getScriptName();
FileEntry userDefinedGrinderProperties = fileEntryService.getOne(user,
FilenameUtils.concat(FilenameUtils.getPath(scriptName), DEFAULT_GRINDER_PROPERTIES), -1L);
if (!config.isSecurityEnabled() && userDefinedGrinderProperties != null) {
// Make the property overridden by user property.
GrinderProperties userProperties = new GrinderProperties();
userProperties.load(new StringReader(userDefinedGrinderProperties.getContent()));
grinderProperties.putAll(userProperties);
}
grinderProperties.setAssociatedFile(new File(DEFAULT_GRINDER_PROPERTIES));
grinderProperties.setProperty(GRINDER_PROP_SCRIPT, scriptHandler.getScriptExecutePath(scriptName));