Created
April 30, 2017 13:52
-
-
Save vinsguru/d0eb1f6211feb679bf0d05286cdb7868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PropertyReader extends ConfigTestElement implements TestBean, TestStateListener { | |
private static final Logger log = LoggingManager.getLoggerForClass(); | |
private String propFilePath; | |
public PropertyReader() { | |
super(); | |
} | |
public void testEnded() { | |
// TODO Auto-generated method stub | |
} | |
public void testEnded(String arg0) { | |
// TODO Auto-generated method stub | |
} | |
public void testStarted() { | |
if (StringUtils.isNotEmpty(getPropFilePath())) { | |
try { | |
Path path = Paths.get(getPropFilePath()); | |
if (!path.isAbsolute()) | |
path = Paths.get(FileServer.getFileServer().getBaseDir(), path.toString()); | |
JMeterUtils.getJMeterProperties().load(new FileInputStream(path.toString())); | |
log.info("Property file reader - loading the properties from " + path); | |
} catch (FileNotFoundException e) { | |
log.error(e.getMessage()); | |
} catch (IOException e) { | |
log.error(e.getMessage()); | |
} | |
} | |
} | |
public void testStarted(String arg0) { | |
testStarted(); | |
} | |
/** | |
* @return the file path | |
*/ | |
public String getPropFilePath() { | |
return this.propFilePath; | |
} | |
/** | |
* @param propFilePath the file path to read | |
*/ | |
public void setPropFilePath(String propFilePath) { | |
this.propFilePath = propFilePath; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment