diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java index f2895faebaa2d6418a1771e5416729c5a620f658..dac4746b6fea2eaf8e3bea76257a89e209cad858 100644 --- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java +++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java @@ -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(); diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java index 17e3ee90835ccb41ea27b04c2fddbc29053f524c..7afcad63d96f741dddb755cece7e421b2ce9b31d 100644 --- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java +++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java @@ -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);