Skip to content
Snippets Groups Projects
Commit 245a6999 authored by Florian Lambers's avatar Florian Lambers
Browse files
parents fc8bea4b 65fc5795
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,7 @@ public class BPMNFormFields {
variableFieldMap.put(formField.getCamundaLabel(), variableFields);
}
//FYI: Hier vllt. für Contstraints in Zukunft interessant
public HashMap<String, List<BPMNFieldConstraint>> getVariableConstraints() {
return variableConstraints;
}
......
......@@ -6,6 +6,7 @@ public class FlowElementEnhancedDTO {
private String name;
private List<String> inputVariables;
private List<String> outputVariables;
public FlowElementEnhancedDTO() {
}
......@@ -25,4 +26,12 @@ public class FlowElementEnhancedDTO {
public void setInputVariables(List<String> inputVariables) {
this.inputVariables = inputVariables;
}
public List<String> getOutputVariables() {
return outputVariables;
}
public void setOutputVariables(List<String> outputVariables) {
this.outputVariables = outputVariables;
}
}
......@@ -352,28 +352,47 @@ public class TestService {
BPMNIOParameters bpmnIOParameters, List<ExternalTopic> externalTopics) {
if (flowElement instanceof StartEvent) {
List<Variable> inputVariables = filterFlowElementVariables(variables,
List<Variable> startVariables = filterFlowElementVariables(variables,
formFields.getVariablesForTask(flowElement.getId()));
return TestgeneratorDSLObjectCreator.createStartFlowElement(flowElement.getId(), inputVariables);
return TestgeneratorDSLObjectCreator.createStartFlowElement(flowElement.getId(), startVariables);
} else if (flowElement instanceof EndEvent) {
return TestgeneratorDSLObjectCreator.createEndFlowElement(flowElement.getId());
} else if (flowElement instanceof Gateway) {
return TestgeneratorDSLObjectCreator.createGatewayFlowElement(flowElement.getId());
} else if (flowElement instanceof UserTask) {
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
inputVariableNames.addAll(formFields.getVariablesForTask(flowElement.getId()));
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createUserTaskFlowElement(flowElement.getId(), inputVariables, flowElement.getName());
return TestgeneratorDSLObjectCreator.createUserTaskFlowElement(flowElement.getId(), inputVariables, outputVariables, flowElement.getName());
} else if (flowElement instanceof ManualTask) {
return TestgeneratorDSLObjectCreator.createManualTaskFlowElement(flowElement.getId(), flowElement.getName());
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createManualTaskFlowElement(flowElement.getId(), inputVariables, outputVariables, flowElement.getName());
} else if (flowElement instanceof ScriptTask) {
return TestgeneratorDSLObjectCreator.createScriptTaskFlowElement(flowElement.getId(), flowElement.getName());
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createScriptTaskFlowElement(flowElement.getId(), inputVariables, outputVariables, flowElement.getName());
} else if (flowElement instanceof BusinessRuleTask) {
String resultVariable = BPMNParseUtils.getResultVariable((BusinessRuleTask) flowElement);
return TestgeneratorDSLObjectCreator.createBusinessRuleTaskFlowElement(flowElement.getId(), resultVariable, flowElement.getName());
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createBusinessRuleTaskFlowElement(flowElement.getId(), resultVariable, inputVariables, outputVariables, flowElement.getName());
} else if (flowElement instanceof ServiceTask) {
String delegate = getDelegate((ServiceTask) flowElement);
......@@ -381,19 +400,32 @@ public class TestService {
ExternalTopic externalTopic = getExternalTopic(externalTopics, externalTopicTextual);
if (delegate != null) {
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createDelegateServiceTaskFlowElement(flowElement.getId(),
delegate, flowElement.getName());
delegate, inputVariables, outputVariables, flowElement.getName());
} else if (externalTopic != null) {
List<VariableDeclaration> hardcodedVariables = BPMNParseUtils.getHardcodedVariables(flowElement.getId(), variables,
bpmnIOParameters);
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createExternalServiceTaskFlowElement(flowElement.getId(),
externalTopic, hardcodedVariables, flowElement.getName());
externalTopic, hardcodedVariables, flowElement.getName(), inputVariables, outputVariables);
} else {
throw new IncompleteFlowElementException(flowElement.getId());
}
} else if (flowElement instanceof SequenceFlow) {
String expression = expressions.getSequenceFlowExpressionMap().get(flowElement.getId());
return TestgeneratorDSLObjectCreator.createSequenceFlowElement(flowElement.getId(), expression);
}
throw new UnsupportedFlowElementException(flowElement.getId());
......
......@@ -6,15 +6,19 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.camunda.bpm.engine.impl.juel.Tree;
import org.camunda.bpm.model.bpmn.BpmnModelInstance;
import org.camunda.bpm.model.bpmn.instance.BusinessRuleTask;
import org.camunda.bpm.model.bpmn.instance.ServiceTask;
import org.camunda.bpm.model.dmn.DmnModelInstance;
import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNBundle;
import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNExpressions;
import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFlowSet;
import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFormFields;
import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNIOParameters;
......@@ -141,8 +145,11 @@ public class BPMNParseUtils {
public static List<Variable> getVariables(BPMNFormFields formFields,
HashMap<String, BPMNTestdata<? extends Object>> variableTestdata, BPMNIOParameters bpmnIOParameters) {
HashMap<String, List<String>> inputList = bpmnIOParameters.getInputParameters();
HashMap<String, List<String>> outputList = bpmnIOParameters.getOutputParameters();
List<String> hardcodedList = bpmnIOParameters.getHardcodedInputParameters();
List<Variable> variables = new ArrayList<>();
List<StringVariable> stringVariables = Stream.concat(Stream.concat(//
formFields.getStringVariables().stream(), //
bpmnIOParameters.getVariables().stream()), //
......@@ -151,12 +158,12 @@ public class BPMNParseUtils {
.map(s -> TestgeneratorDSLObjectCreator.createStringVariable(s,
getProposals(s, variableTestdata.get(s), String.class))) //
.collect(Collectors.toList()); //
// List<StringVariable> stringVariables = formFields.getStringVariables().stream() //
// .map(s -> TestgeneratorDSLObjectCreator.createStringVariable(s,
// getProposals(s, variableTestdata.get(s), String.class))) //
// .collect(Collectors.toList());
List<IntVariable> longVariables = Stream.concat( //
formFields.getLongVariables().stream(), //
bpmnIOParameters.getHardcodedInputParametersLong().stream() //
......@@ -164,7 +171,6 @@ public class BPMNParseUtils {
.map(i -> TestgeneratorDSLObjectCreator.createIntVariable(i,
getIntProposals(i, variableTestdata.get(i)))) //
.collect(Collectors.toList());
List<BooleanVariable> booleanVariables = Stream.concat(//
formFields.getBooleanVariables().stream(), //
bpmnIOParameters.getHardcodedInputParametersBoolean().stream() //
......@@ -172,11 +178,9 @@ public class BPMNParseUtils {
.map(b -> TestgeneratorDSLObjectCreator.createBooleanVariable(b,
getProposals(b, variableTestdata.get(b), Boolean.class))) //
.collect(Collectors.toList());
variables.addAll(stringVariables);
variables.addAll(longVariables);
variables.addAll(booleanVariables);
return variables;
}
......@@ -257,7 +261,6 @@ public class BPMNParseUtils {
.map(entry -> VariableConverter.getVariableDeclaration(variables, entry.getKey(), entry.getValue())) //
.forEach(variableDeclaration -> hardcodedVariables.add(variableDeclaration)); //
}
return hardcodedVariables;
}
}
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