refactor(接口测试): 按照线程组隔离文件读取逻辑
Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
f96c359571
commit
4f9f9ee2d1
|
@ -255,8 +255,8 @@ public class FileServer {
|
||||||
throw new IllegalArgumentException("Alias must not be null");
|
throw new IllegalArgumentException("Alias must not be null");
|
||||||
}
|
}
|
||||||
// todo 这里更改了原始代码
|
// todo 这里更改了原始代码
|
||||||
if(!new File(filename).exists()){
|
if (!new File(filename).exists()) {
|
||||||
log.error("file does not exist [ "+ filename+" ]");
|
log.error("file does not exist [ " + filename + " ]");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,8 +575,15 @@ public class FileServer {
|
||||||
* @return {@link File} instance
|
* @return {@link File} instance
|
||||||
*/
|
*/
|
||||||
public File getResolvedFile(String path) {
|
public File getResolvedFile(String path) {
|
||||||
|
log.info("getResolvedFile: {}", path);
|
||||||
|
String threadName = JMeterContextService.getContext().getThread().getThreadName();
|
||||||
|
if (!StringUtils.contains(path, threadName)) {
|
||||||
|
path = StringUtils.join(threadName, path);
|
||||||
|
}
|
||||||
reserveFile(path);
|
reserveFile(path);
|
||||||
return files.get(path).file;
|
|
||||||
|
FileEntry fileEntry = files.get(path);
|
||||||
|
return fileEntry != null ? fileEntry.file : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FileEntry {
|
private static class FileEntry {
|
||||||
|
|
Loading…
Reference in New Issue