Lines 46-55
Link Here
|
46 |
import org.apache.jmeter.samplers.SampleSaveConfiguration; |
46 |
import org.apache.jmeter.samplers.SampleSaveConfiguration; |
47 |
import org.apache.jmeter.save.CSVSaveService; |
47 |
import org.apache.jmeter.save.CSVSaveService; |
48 |
import org.apache.jmeter.save.SaveService; |
48 |
import org.apache.jmeter.save.SaveService; |
|
|
49 |
import org.apache.jmeter.services.FileServer; |
49 |
import org.apache.jmeter.testelement.TestElement; |
50 |
import org.apache.jmeter.testelement.TestElement; |
50 |
import org.apache.jmeter.testelement.TestListener; |
51 |
import org.apache.jmeter.testelement.TestListener; |
51 |
import org.apache.jmeter.testelement.property.BooleanProperty; |
52 |
import org.apache.jmeter.testelement.property.BooleanProperty; |
52 |
import org.apache.jmeter.testelement.property.ObjectProperty; |
53 |
import org.apache.jmeter.testelement.property.ObjectProperty; |
|
|
54 |
import org.apache.jmeter.util.JMeterUtils; |
53 |
import org.apache.jmeter.visualizers.Visualizer; |
55 |
import org.apache.jmeter.visualizers.Visualizer; |
54 |
import org.apache.jorphan.logging.LoggingManager; |
56 |
import org.apache.jorphan.logging.LoggingManager; |
55 |
import org.apache.jorphan.util.JMeterError; |
57 |
import org.apache.jorphan.util.JMeterError; |
Lines 99-104
Link Here
|
99 |
//@GuardedBy("LOCK") |
101 |
//@GuardedBy("LOCK") |
100 |
private static final Map<String, FileEntry> files = new HashMap<String, FileEntry>(); |
102 |
private static final Map<String, FileEntry> files = new HashMap<String, FileEntry>(); |
101 |
|
103 |
|
|
|
104 |
/** |
105 |
* JMeter property that determines if the path is relative to the |
106 |
* script or the launch directory |
107 |
*/ |
108 |
private static final String PATH_RELATIVE_TO = "path.relative.to"; |
109 |
|
102 |
/* |
110 |
/* |
103 |
* Keep track of the file writer and the configuration, |
111 |
* Keep track of the file writer and the configuration, |
104 |
* as the instance used to close them is not the same as the instance that creates |
112 |
* as the instance used to close them is not the same as the instance that creates |
Lines 291-296
Link Here
|
291 |
boolean parsedOK = false; |
299 |
boolean parsedOK = false; |
292 |
String filename = getFilename(); |
300 |
String filename = getFilename(); |
293 |
File file = new File(filename); |
301 |
File file = new File(filename); |
|
|
302 |
String pathProperty = JMeterUtils.getProperty(PATH_RELATIVE_TO); |
303 |
|
304 |
if(pathProperty != null && "script".equalsIgnoreCase(pathProperty)){ |
305 |
if(!file.isAbsolute()){ |
306 |
log.info("loading file with relative path: " +filename); |
307 |
file = new File(FileServer.getFileServer().getBaseDir(), filename); |
308 |
log.info("file path set to: "+filename); |
309 |
} |
310 |
} |
311 |
|
294 |
if (file.exists()) { |
312 |
if (file.exists()) { |
295 |
BufferedReader dataReader = null; |
313 |
BufferedReader dataReader = null; |
296 |
BufferedInputStream bufferedInputStream = null; |
314 |
BufferedInputStream bufferedInputStream = null; |
Lines 375-380
Link Here
|
375 |
if (filename == null || filename.length() == 0) { |
393 |
if (filename == null || filename.length() == 0) { |
376 |
return null; |
394 |
return null; |
377 |
} |
395 |
} |
|
|
396 |
File file = new File(filename); |
397 |
String pathProperty = JMeterUtils.getProperty(PATH_RELATIVE_TO); |
398 |
|
399 |
if(pathProperty != null && "script".equalsIgnoreCase(pathProperty)){ |
400 |
if(!file.isAbsolute()){ |
401 |
log.info("loading file with relative path: " +filename); |
402 |
filename = FileServer.getFileServer().getBaseDir() +File.separator+ filename; |
403 |
log.info("file path set to: "+filename); |
404 |
} |
405 |
} |
378 |
FileEntry fe = files.get(filename); |
406 |
FileEntry fe = files.get(filename); |
379 |
PrintWriter writer = null; |
407 |
PrintWriter writer = null; |
380 |
boolean trimmed = true; |
408 |
boolean trimmed = true; |