diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext index 544fa6763e974fe68c468b2194794e282be9f71b..6780405bb2b038940f810d4f1ed8186c0bbf3da9 100644 --- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext +++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext @@ -123,18 +123,21 @@ StringVariable: "String" name=ID "with" "proposals" ASSOCIATION LIST_OPEN (proposals+=STRING (SEPARATOR proposals+=STRING)*)? LIST_CLOSED "with" "constraints" ASSOCIATION LIST_OPEN (constraints+=Constraint (SEPARATOR constraints+=Constraint)*)? LIST_CLOSED + ("(" creationType=VariableCreationType ")")? DECLARATION_FINISHED; IntVariable: "Integer" name=ID "with" "proposals" ASSOCIATION LIST_OPEN (proposals+=INT (SEPARATOR proposals+=INT)*)? LIST_CLOSED "with" "constraints" ASSOCIATION LIST_OPEN (constraints+=Constraint (SEPARATOR constraints+=Constraint)*)? LIST_CLOSED + ("(" creationType=VariableCreationType ")")? DECLARATION_FINISHED; BooleanVariable: "Boolean" name=ID "with" "proposals" ASSOCIATION LIST_OPEN (proposals+=Boolean (SEPARATOR proposals+=Boolean)*)? LIST_CLOSED "with" "constraints" ASSOCIATION LIST_OPEN (constraints+=Constraint (SEPARATOR constraints+=Constraint)*)? LIST_CLOSED + ("(" creationType=VariableCreationType ")")? DECLARATION_FINISHED; enum Boolean: @@ -289,6 +292,10 @@ enum GatewayType: OR = "OR" | XOR = "XOR" | PARALLEL = "PARALLEL"; + +enum VariableCreationType: + AUTOMATIC = "AUTOMATIC" | + MANUALLY = "MANUALLY"; terminal LIST_OPEN : '['; terminal LIST_CLOSED : ']'; diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/generator/TestgeneratorDSLGenerator.xtend b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/generator/TestgeneratorDSLGenerator.xtend index 3d9c5e0fa489b61a6eb46ca382a9797143786da7..36459899d84e87f23d316192e7da077e1f2f1711 100644 --- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/generator/TestgeneratorDSLGenerator.xtend +++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/generator/TestgeneratorDSLGenerator.xtend @@ -419,25 +419,29 @@ class TestgeneratorDSLGenerator extends AbstractGenerator { if (check instanceof PassedCheck) { addAssertPassed(check); + appendLine(codeformatLine(!progressChecksIterator.hasNext())); } if (check instanceof NotPassedCheck) { - addAssertNotPassed(check); +// addAssertNotPassed(check); } if (check instanceof ProcessStartedCheck) { addAssertStarted(check); + appendLine(codeformatLine(!progressChecksIterator.hasNext())); } if (check instanceof VariablesCheck) { addAssertVariables(check); + appendLine(codeformatLine(!progressChecksIterator.hasNext())); } if (check instanceof ProcessEndedCheck) { addAssertEnded(check); + appendLine(codeformatLine(!progressChecksIterator.hasNext())); } - appendLine(codeformatLine(!progressChecksIterator.hasNext())); + } } diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLSerializer.java b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLSerializer.java index 8618df18450740c14164402f80a27d089c20a179..7fa202966dbc0856c283919ad5e44ca799299896 100644 --- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLSerializer.java +++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLSerializer.java @@ -49,6 +49,7 @@ import de.fhmuenster.masterthesis.testgeneratorDSL.Test; import de.fhmuenster.masterthesis.testgeneratorDSL.TestgeneratorDSLFactory; import de.fhmuenster.masterthesis.testgeneratorDSL.UserTaskFlowElement; import de.fhmuenster.masterthesis.testgeneratorDSL.Variable; +import de.fhmuenster.masterthesis.testgeneratorDSL.VariableCreationType; import de.fhmuenster.masterthesis.utils.TestgeneratorDSLUtils; @SuppressWarnings("restriction") @@ -226,6 +227,14 @@ public class TestgeneratorDSLSerializer { variableProposals.addAll(booleanProposals); return variableProposals; } + + public List<Variable> getManuallyCreatedVariables() { + return model.getDeclarations().stream() // + .filter(d -> d instanceof Variable) // + .map(varDecl -> ((Variable) varDecl)) // + .filter(varDecl -> varDecl.getCreationType().equals(VariableCreationType.MANUALLY)) + .collect(Collectors.toList()); // + } public Mock getMock(String name) { Optional<Mock> mockOpt = model.getDeclarations().stream() // @@ -366,6 +375,18 @@ public class TestgeneratorDSLSerializer { } } + public void deleteFlow(String name) { + Optional<Flow> flowOpt = model.getDeclarations().stream() // + .filter(d -> d instanceof Flow) // + .map(flow -> ((Flow) flow)) // + .filter(flow -> flow.getName().equals(name)) // + .findFirst(); // + + if(flowOpt.isPresent()) { + model.getDeclarations().remove(flowOpt.get()); + } + } + public Map<String, Long> getFlowTestCount() { return model.getDeclarations().stream() .filter(d -> d instanceof Test) // @@ -449,6 +470,18 @@ public class TestgeneratorDSLSerializer { model.getDeclarations().add(externalTopic); } + public void deleteExternalTopic(String name) { + Optional<ExternalTopic> topicOpt = model.getDeclarations().stream() // + .filter(d -> d instanceof ExternalTopic) // + .map(externalTopic -> ((ExternalTopic) externalTopic)) // + .filter(externalTopic -> externalTopic.getName().equals(name)) // + .findFirst(); // + + if(topicOpt.isPresent()) { + model.getDeclarations().remove(topicOpt.get()); + } + } + public void addLoop(Loop loop) { model.getDeclarations().add(loop); } @@ -463,52 +496,14 @@ public class TestgeneratorDSLSerializer { return findFirst.isPresent() ? findFirst.get() : null; } - public EList<FlowElementReference> updateInclElements(EList<FlowElementReference> fers, String flowName) { - /* + public List<ExternalTopic> getExternalTopics() { return model.getDeclarations().stream() // - .filter(d -> d instanceof FlowElementReference) // - .map(fer -> ((FlowElementReference) fer)) // - .filter(fer -> fer.getRef().get) // + .filter(e -> e instanceof ExternalTopic) // + .map(e -> ((ExternalTopic) e)) // .collect(Collectors.toList()); // - - - for(Declaration d : model.getDeclarations()) { - if(d instanceof FlowElement) { - Flow mappedFlow = (Flow) d; - if(mappedFlow.getName().equals(f.getName())) { - mappedFlow.getInclElements() - } - } - } - */ - - //Flow flow = this.getFlow(flowName); - - Flow flow = this.getFlow(flowName); - EList<FlowElementReference> newFers = new BasicEList<>(); - //Collections.copy(newFers, f.getInclElements()); - - - - for(FlowElementReference r : fers) { - FlowElementReference ref = TestgeneratorDSLFactory.eINSTANCE.createFlowElementReference(); - System.out.println("Ausgabe von den alten fers : " + r.getFlag()); - //ref.setFlag(Flag.YELLOW); - ref.setRef(r.getRef()); - ref.setFlag(r.getFlag()); - - //this.getFlowElements(null) - - newFers.add(ref); - } - - flow.getInclElements().clear(); - flow.getInclElements().addAll(newFers); - flow.setFlowSize(flow.getInclElements().size()); - - return newFers; } - + + public void serialize() throws IOException { String serialized = serializer.serialize(model); serialized = serialized.replace(" ", " ");