Skip to content
Snippets Groups Projects
Commit 7873b118 authored by Florian Lambers's avatar Florian Lambers
Browse files

added constraints

parent 05397ae2
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ public class Main {
Arrays.asList("decision.dmn"),
Arrays.asList("wup.html")); //
FlowElement start = TestgeneratorDSLObjectCreator.createStartFlowElement("Start_123", Arrays.asList());
FlowElement start = TestgeneratorDSLObjectCreator.createStartFlowElement("Start_123", Arrays.asList(), null);
FlowElement gateway = TestgeneratorDSLObjectCreator.createGatewayFlowElement("Gateway_123");
FlowElement activity = TestgeneratorDSLObjectCreator.createUserTaskFlowElement("Activity_123", Arrays.asList(), Arrays.asList(), "Activity 123", null);
FlowElement end = TestgeneratorDSLObjectCreator.createEndFlowElement("End_123");
......@@ -81,7 +81,7 @@ public class Main {
private static void doFourth() throws IOException {
TestgeneratorDSLSerializer serialize = new TestgeneratorDSLSerializer("C:\\Users\\Leon\\Desktop\\Test123.bpmn-testgen");
FlowElement start3 = TestgeneratorDSLObjectCreator.createStartFlowElement("Start_789", Arrays.asList());
FlowElement start3 = TestgeneratorDSLObjectCreator.createStartFlowElement("Start_789", Arrays.asList(), null);
serialize.addFlowElement(start3);
serialize.serialize();
......
......@@ -27,6 +27,7 @@ import de.fhmuenster.masterthesis.testgeneratorDSL.ExternalServiceMock;
import de.fhmuenster.masterthesis.testgeneratorDSL.ExternalServiceTaskFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.ExternalTopic;
import de.fhmuenster.masterthesis.testgeneratorDSL.ExternalTopicReference;
import de.fhmuenster.masterthesis.testgeneratorDSL.Flag;
import de.fhmuenster.masterthesis.testgeneratorDSL.Flow;
import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElementReference;
......@@ -90,7 +91,7 @@ public class TestgeneratorDSLObjectCreator {
return bpmnDiagram;
}
public static StartFlowElement createStartFlowElement(String name, List<Variable> startVariables) {
public static StartFlowElement createStartFlowElement(String name, List<Variable> startVariables, HashMap<String, List<Constraint>> taskSpecificConstraints) {
StartFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createStartFlowElement();
element.setName(name);
......@@ -98,6 +99,16 @@ public class TestgeneratorDSLObjectCreator {
VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
variableReference.setRef(startVar);
element.getInputVariables().add(variableReference);
if(taskSpecificConstraints.get(startVar.getName()) != null) {
for(Constraint c : taskSpecificConstraints.get(startVar.getName())) {
if(c.getKey().equals("required")) {
if(c.getValue() == 0) {
variableReference.setValidationStatus(ValidationState.OPTIONAL);
}
}
}
}
}
return element;
......@@ -365,7 +376,7 @@ public class TestgeneratorDSLObjectCreator {
return manualMock;
}
public static Test createTest(String name, Flow flow, List<VariableDeclarations> variableDeclarations, EndChecks endChecks, List<Mock> mocks, int priority) {
public static Test createTest(String name, Flow flow, List<VariableDeclarations> variableDeclarations, EndChecks endChecks, List<Mock> mocks, int priority, Flag flag) {
FlowReference flowReference = TestgeneratorDSLFactory.eINSTANCE.createFlowReference();
flowReference.setRef(flow);
......@@ -381,6 +392,7 @@ public class TestgeneratorDSLObjectCreator {
test.setName(name);
test.setFlowReference(flowReference);
test.setPriority(priority);
test.setFlag(flag);
test.getDeclarations().addAll(variableDeclarations);
test.getMocks().addAll(mockRefs);
......
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