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

bugfix variable type to DSL

integer still not working, but fixxed it for String and Boolean
parent 3ebbbf87
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,9 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLObjectCreator;
import de.fhmuenster.masterthesis.testgeneratorDSL.BooleanVariable;
import de.fhmuenster.masterthesis.testgeneratorDSL.IntVariable;
import de.fhmuenster.masterthesis.testgeneratorDSL.StringVariable;
import de.fhmuenster.masterthesis.testgeneratorDSL.TestgeneratorDSLFactory;
import de.fhmuenster.masterthesis.testgeneratorDSL.VariableReference;
......@@ -80,43 +83,63 @@ public class BPMNIOParameters {
* @param taskId
*/
public void addSetVariable(String flowElementId, String setVarName, Object setVarValue) {
// setVartiable == writeVariables/outputVariables
List<String> existingVariables = this.outputVariables.get(flowElementId);
List<String> variables = existingVariables != null ? existingVariables : new ArrayList<>();
if(!variables.contains(setVarName))
try
{
// Need to create a new Variable
// Check Variable Type and create Variable if needed
if(setVarValue instanceof Integer)
{
List<Integer> iList = new ArrayList<>();
iList.add((Integer) setVarValue);
TestgeneratorDSLObjectCreator.createIntVariable(setVarName, iList);
variables.add(setVarName);
HashMap<String, Long> existingVariables = this.hardcodedInputParametersLong.get(flowElementId);
HashMap<String, Long> variables = existingVariables != null ? existingVariables : new HashMap<>();
if(!variables.containsKey(setVarName))
{
List<Integer> iValueList = new ArrayList<>();
iValueList.add((Integer) setVarValue);
TestgeneratorDSLObjectCreator.createIntVariable(setVarName, iValueList);
Long lvar = (Long) setVarValue;
variables.put(flowElementId, lvar);
}
this.hardcodedInputParametersLong.put(flowElementId, variables);
}
else if(setVarValue instanceof Boolean)
{
List<Boolean> bList = new ArrayList<>();
bList.add((Boolean) setVarValue);
TestgeneratorDSLObjectCreator.createBooleanVariable(setVarName, bList);
variables.add(setVarName);
HashMap<String, Boolean> existingVariables = this.hardcodedInputParametersBoolean.get(flowElementId);
HashMap<String, Boolean> variables = existingVariables != null ? existingVariables : new HashMap<>();
if(!variables.containsKey(setVarName))
{
List<Boolean> bValueList = new ArrayList<>();
bValueList.add((Boolean) setVarValue);
TestgeneratorDSLObjectCreator.createBooleanVariable(setVarName, bValueList);
variables.put(setVarName, (Boolean) setVarValue);
}
this.hardcodedInputParametersBoolean.put(flowElementId, variables);
}
else if(setVarValue instanceof String)
{
List<String> sList = new ArrayList<>();
sList.add((String) setVarValue);
TestgeneratorDSLObjectCreator.createStringVariable(setVarName, sList);
variables.add(setVarName);
List<String> existingVariables = this.outputVariables.get(flowElementId);
List<String> variables = existingVariables != null ? existingVariables : new ArrayList<>();
if(!variables.contains(setVarName))
{
List<String> sList = new ArrayList<>();
sList.add((String) setVarValue);
TestgeneratorDSLObjectCreator.createStringVariable(setVarName, sList);
variables.add(setVarName);
}
this.outputVariables.put(flowElementId, variables);
}
}
else
catch(Exception e)
{
// Variable already exists
variables.add(setVarName);
System.out.println("[DEBUG] " + e.getMessage());
}
this.outputVariables.put(flowElementId, variables);
}
/**
......
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