Skip to content
Snippets Groups Projects
Commit b3b0913d authored by Henning's avatar Henning
Browse files

fix setting readVariables for all kind of compare operators

parent 643d17ec
No related branches found
No related tags found
No related merge requests found
......@@ -109,7 +109,7 @@ public class TestService {
public TestService() {
}
public List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> initLoops(Project project) {
Path testFilePath = ProjectDirectoryUtils.getTestspecificationPath(project.getProjectDirectories());
String testpackage = project.getProjectDirectories().getTestPackage();
......@@ -800,42 +800,28 @@ public class TestService {
private List<Variable> mapExpressionToReadVariable(String expression, List<Variable> variables) {
List<Variable> inputVariables = new ArrayList<Variable>();
String[] operators = {"==", "<", ">"}; // <,> is the same as >=, <= while using string function contains
if(expression != null) {
if(expression.contains("==")) {
Pattern pattern = Pattern.compile("\\{(.*?)\\=");
Matcher matcher = pattern.matcher(expression);
if (matcher.find()) {
for(Variable var: variables) {
if(matcher.group(1).equals(var.getName())) {
inputVariables.add(var);
}
}
}
pattern = Pattern.compile("\\{(.*?)\\ =");
matcher = pattern.matcher(expression);
if (matcher.find()) {
for(Variable var: variables) {
if(matcher.group(1).equals(var.getName())) {
inputVariables.add(var);
}
}
}
}
if(expression.contains("==") == false) {
Pattern pattern = Pattern.compile("\\{(.*?)\\}");
Matcher matcher = pattern.matcher(expression);
if (matcher.find()) {
for(Variable var: variables) {
if(matcher.group(1).equals(var.getName())) {
inputVariables.add(var);
}
}
for(String operator : operators)
{
if(expression.contains(operator))
{
Pattern pattern = Pattern.compile("\\{(.*?)\\}");
Matcher matcher = pattern.matcher(expression);
if (matcher.find()) {
for(Variable var: variables) {
if(expression.contains(var.getName())) {
inputVariables.add(var);
}
}
}
}
}
}
}
return inputVariables;
}
private List<Variable> getReadVariables(String flowElementId, BPMNIOParameters bpmnIOParameters, List<Variable> variables, BPMNFormFields formFields) {
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElementId));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment