automation.library.conversion2jmx.common.utils.ValueUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of library-conversion2jmx Show documentation
Show all versions of library-conversion2jmx Show documentation
The 'conversion2jmx' library to helps creating JMeter JMX files from different sources
The newest version!
package automation.library.conversion2jmx.common.utils;
import java.util.ArrayList;
import java.util.List;
public class ValueUtils {
private static final String[] patterns = {".environment.set", ".setGlobalVariable", ".setEnvironmentVariable", ".globals.set"};
public static String value(String value) {
if (value == null) {
return "";
}
if (value.contains("{{") && value.contains("}}")) {
value = value.replace("{{", "${");
value = value.replace("}}", "}");
}
return value;
}
public static List extractVariables(List execs) {
List variables = new ArrayList<>();
for (String exec : execs) {
if (exec.contains(patterns[0]) || exec.contains(patterns[1]) || exec.contains(patterns[2]) || exec.contains(patterns[3])) {
String variable = exec.substring(exec.indexOf("(") + 1, exec.indexOf(","));
variable = variable.trim().replace("\'", "").replace("\"", "");
variables.add(variable);
}
}
return variables;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy