Skip to content

Commit

Permalink
Integrated core lang model into cucumber grammar
Browse files Browse the repository at this point in the history
76: Unable to hide/suppress warnings on feature files

Task-Url: rlogiacco#76

Signed-off-by: Aaron R Miller <[email protected]>
  • Loading branch information
Aaron R Miller committed Aug 3, 2020
1 parent de4829b commit 0e508b2
Show file tree
Hide file tree
Showing 16 changed files with 800 additions and 775 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.agileware.natural.cucumber.tests

import org.agileware.natural.cucumber.model.CucumberModel
import org.agileware.natural.lang.model.DocumentModel
import org.agileware.natural.testing.AbstractExamplesTest
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.junit.runner.RunWith

@RunWith(XtextRunner)
@InjectWith(CucumberInjectorProvider)
class CucumberExamplesTest extends AbstractExamplesTest<CucumberModel> {}
class CucumberExamplesTest extends AbstractExamplesTest<DocumentModel> {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define(["ace/lib/oop", "ace/mode/text", "ace/mode/text_highlight_rules"], function(oop, mText, mTextHighlightRules) {
var HighlightRules = function() {
var keywords = "Scenario";
var keywords = "Outline|Scenario";
this.$rules = {
"start": [
{token: "keyword", regex: "\\b(?:" + keywords + ")\\b"}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* generated by Xtext 2.23.0-SNAPSHOT
*/
package org.agileware.natural.cucumber.web;

import com.google.inject.Injector;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import org.eclipse.xtext.util.DisposableRegistry;
import org.eclipse.xtext.web.servlet.XtextServlet;

/**
* Deploy this class into a servlet container to enable DSL-specific services.
*/
@WebServlet(name = "XtextServices", urlPatterns = "/xtext-service/*")
public class CucumberServlet extends XtextServlet {

DisposableRegistry disposableRegistry;

public void init() throws ServletException {
super.init();
Injector injector = new CucumberWebSetup().createInjectorAndDoEMFRegistration();
this.disposableRegistry = injector.getInstance(DisposableRegistry.class);
}

public void destroy() {
if (disposableRegistry != null) {
disposableRegistry.dispose();
disposableRegistry = null;
}
super.destroy();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* generated by Xtext 2.23.0-SNAPSHOT
*/
package org.agileware.natural.cucumber.web;

import java.net.InetSocketAddress;
import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.log.Slf4jLog;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.MetaInfConfiguration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebInfConfiguration;
import org.eclipse.jetty.webapp.WebXmlConfiguration;

/**
* This program starts an HTTP server for testing the web integration of your DSL.
* Just execute it and point a web browser to http://localhost:8080/
*/
public class ServerLauncher {
public static void main(String[] args) {
Server server = new Server(new InetSocketAddress("localhost", 8080));
WebAppContext ctx = new WebAppContext();
ctx.setResourceBase("WebRoot");
ctx.setWelcomeFiles(new String[] {"index.html"});
ctx.setContextPath("/");
ctx.setConfigurations(new Configuration[] {
new AnnotationConfiguration(),
new WebXmlConfiguration(),
new WebInfConfiguration(),
new MetaInfConfiguration()
});
ctx.setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN,
".*/org\\.agileware\\.natural\\.cucumber\\.web/.*,.*\\.jar");
ctx.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
server.setHandler(ctx);
Slf4jLog log = new Slf4jLog(ServerLauncher.class.getName());
try {
server.start();
log.info("Server started " + server.getURI() + "...");
new Thread() {

public void run() {
try {
log.info("Press enter to stop the server...");
int key = System.in.read();
if (key != -1) {
server.stop();
} else {
log.warn(
"Console input is not available. In order to stop the server, you need to cancel process manually.");
}
} catch (Exception e) {
log.warn(e);
}
}

}.start();
server.join();
} catch (Exception exception) {
log.warn(exception.getMessage());
System.exit(1);
}
}
}
19 changes: 9 additions & 10 deletions org.agileware.natural.cucumber/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bundle-SymbolicName: org.agileware.natural.cucumber; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.agileware.natural.common;visibility:=reexport,
org.agileware.natural.stepmatcher;visibility:=reexport,
org.agileware.natural.lang;visibility:=reexport,
org.eclipse.xtext,
org.eclipse.xtext.xbase,
org.eclipse.equinox.common;bundle-version="3.5.0",
Expand All @@ -19,11 +20,14 @@ Require-Bundle: org.agileware.natural.common;visibility:=reexport,
org.antlr.runtime;bundle-version="[3.2.0,3.2.1)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.agileware.natural.cucumber;uses:="com.google.inject,org.eclipse.xtext.service,org.eclipse.xtext",
org.agileware.natural.cucumber.model;uses:="org.eclipse.emf.ecore,org.eclipse.emf.common.util",
org.agileware.natural.cucumber.formatting2;uses:="org.agileware.natural.lang.model,org.eclipse.xtext.formatting2",
org.agileware.natural.cucumber.generator;uses:="org.eclipse.xtext.generator,org.eclipse.emf.ecore.resource",
org.agileware.natural.cucumber.model;uses:="org.eclipse.emf.ecore,org.eclipse.emf.common.util,org.agileware.natural.lang.model",
org.agileware.natural.cucumber.model.impl;
uses:="org.eclipse.emf.ecore,
org.eclipse.emf.ecore.impl,
org.eclipse.emf.common.util,
org.agileware.natural.lang.model,
org.eclipse.emf.common.notify,
org.agileware.natural.cucumber.model",
org.agileware.natural.cucumber.model.util;
Expand All @@ -32,19 +36,14 @@ Export-Package: org.agileware.natural.cucumber;uses:="com.google.inject,org.ecli
org.eclipse.emf.common.notify.impl,
org.eclipse.emf.ecore.util,
org.agileware.natural.cucumber.model",
org.agileware.natural.cucumber.formatting2;uses:="org.eclipse.xtext.formatting2,org.agileware.natural.cucumber.model",
org.agileware.natural.cucumber.generator;uses:="org.eclipse.xtext.generator,org.eclipse.emf.ecore.resource",
org.agileware.natural.cucumber.parser.antlr;uses:="org.eclipse.xtext.parser.antlr,org.agileware.natural.cucumber.parser.antlr.internal,org.agileware.natural.cucumber.services",
org.agileware.natural.cucumber.parser.antlr.internal;
uses:="org.eclipse.emf.ecore,
org.eclipse.xtext.parser.antlr,
org.antlr.runtime,
org.agileware.natural.cucumber.services",
org.agileware.natural.cucumber.scoping;uses:="org.eclipse.xtext.scoping.impl",
org.agileware.natural.cucumber.serializer;uses:="org.agileware.natural.cucumber.model",
org.agileware.natural.cucumber.services;uses:="org.eclipse.xtext.service,org.eclipse.xtext",
org.agileware.natural.cucumber.validation;uses:="org.eclipse.xtext.util,org.eclipse.xtext.validation",
org.agileware.natural.cucumber.model.impl,
org.agileware.natural.cucumber.model.util,
org.agileware.natural.cucumber.model
org.agileware.natural.cucumber.scoping;uses:="org.agileware.natural.lang.scoping",
org.agileware.natural.cucumber.serializer;uses:="org.agileware.natural.lang.model",
org.agileware.natural.cucumber.services;uses:="org.agileware.natural.lang.services,org.eclipse.xtext.service,org.eclipse.xtext",
org.agileware.natural.cucumber.validation;uses:="org.agileware.natural.lang.validation,org.eclipse.xtext.util,org.eclipse.xtext.validation"
Import-Package: org.apache.log4j
63 changes: 12 additions & 51 deletions org.agileware.natural.cucumber/model/generated/Cucumber.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,27 @@
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model" nsURI="http://www.agileware.org/natural/cucumber" nsPrefix="model">
<eClassifiers xsi:type="ecore:EClass" name="CucumberModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="locale" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="feature" eType="#//Feature"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractScenario" eSuperTypes="#//Section">
<eStructuralFeatures xsi:type="ecore:EReference" name="steps" upperBound="-1"
eType="#//Step" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Section">
<eStructuralFeatures xsi:type="ecore:EReference" name="tags" upperBound="-1" eType="#//Tag"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="narrative" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Feature" eSuperTypes="#//Section">
<eStructuralFeatures xsi:type="ecore:EReference" name="background" eType="#//Background"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scenarios" upperBound="-1"
eType="#//AbstractScenario" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Background" eSuperTypes="#//AbstractScenario #//Section"/>
<eClassifiers xsi:type="ecore:EClass" name="Feature"/>
<eClassifiers xsi:type="ecore:EClass" name="AbstractScenario"/>
<eClassifiers xsi:type="ecore:EClass" name="Background" eSuperTypes="#//AbstractScenario"/>
<eClassifiers xsi:type="ecore:EClass" name="Scenario" eSuperTypes="#//AbstractScenario"/>
<eClassifiers xsi:type="ecore:EClass" name="ScenarioOutline" eSuperTypes="#//AbstractScenario">
<eStructuralFeatures xsi:type="ecore:EReference" name="examples" upperBound="-1"
eType="#//Example" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ScenarioOutline" eSuperTypes="#//AbstractScenario"/>
<eClassifiers xsi:type="ecore:EClass" name="Step">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="keyword" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="table" eType="#//Table"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="code" eType="#//DocString"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Example" eSuperTypes="#//Section">
<eStructuralFeatures xsi:type="ecore:EReference" name="table" eType="#//Table"
<eClassifiers xsi:type="ecore:EClass" name="Section" eSuperTypes="#//Feature #//Background #//Scenario #//ScenarioOutline">
<eStructuralFeatures xsi:type="ecore:EReference" name="meta" eType="ecore:EClass platform:/resource/org.agileware.natural.lang/model/generated/Natural.ecore#//Meta"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Table">
<eStructuralFeatures xsi:type="ecore:EReference" name="rows" upperBound="-1" eType="#//TableRow"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TableRow">
<eStructuralFeatures xsi:type="ecore:EReference" name="cols" upperBound="-1" eType="#//TableCol"
<eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="narrative" eType="ecore:EClass platform:/resource/org.agileware.natural.lang/model/generated/Natural.ecore#//Narrative"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TableCol">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="cell" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DocString">
<eStructuralFeatures xsi:type="ecore:EReference" name="text" eType="#//Text" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Tag">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Text">
<eStructuralFeatures xsi:type="ecore:EReference" name="lines" upperBound="-1"
eType="#//TextLine" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TextLine">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scenarios" upperBound="-1"
eType="#//AbstractScenario" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="steps" upperBound="-1"
eType="#//Step" containment="true"/>
</eClassifiers>
</ecore:EPackage>
54 changes: 11 additions & 43 deletions org.agileware.natural.cucumber/model/generated/Cucumber.genmodel
Original file line number Diff line number Diff line change
@@ -1,61 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.21.0" modelDirectory="/org.agileware.natural.cucumber/src-gen"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.23.0-SNAPSHOT" modelDirectory="/org.agileware.natural.cucumber/src-gen"
modelPluginID="org.agileware.natural.cucumber" forceOverwrite="true" modelName="Cucumber"
updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
complianceLevel="8.0" copyrightFields="false" runtimeVersion="2.20">
complianceLevel="8.0" copyrightFields="false" runtimeVersion="2.20" usedGenPackages="platform:/resource/org.agileware.natural.lang/model/generated/Natural.genmodel#//model">
<genPackages prefix="Model" basePackage="org.agileware.natural.cucumber" disposableProviderFactory="true"
fileExtensions="feature" ecorePackage="Cucumber.ecore#/">
<genClasses ecoreClass="Cucumber.ecore#//CucumberModel">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//CucumberModel/locale"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//CucumberModel/feature"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//AbstractScenario">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//AbstractScenario/steps"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//Section">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Section/tags"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//Section/title"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//Section/narrative"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//Feature">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Feature/background"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Feature/scenarios"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//Feature"/>
<genClasses ecoreClass="Cucumber.ecore#//AbstractScenario"/>
<genClasses ecoreClass="Cucumber.ecore#//Background"/>
<genClasses ecoreClass="Cucumber.ecore#//Scenario"/>
<genClasses ecoreClass="Cucumber.ecore#//ScenarioOutline">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//ScenarioOutline/examples"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//ScenarioOutline"/>
<genClasses ecoreClass="Cucumber.ecore#//Step">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//Step/keyword"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//Step/description"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Step/table"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Step/code"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//Example">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Example/table"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//Table">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Table/rows"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//TableRow">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//TableRow/cols"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//TableCol">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//TableCol/cell"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//DocString">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//DocString/text"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//Tag">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//Tag/id"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//Text">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Text/lines"/>
</genClasses>
<genClasses ecoreClass="Cucumber.ecore#//TextLine">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//TextLine/value"/>
<genClasses ecoreClass="Cucumber.ecore#//Section">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Section/meta"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Cucumber.ecore#//Section/title"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Section/narrative"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Section/scenarios"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Cucumber.ecore#//Section/steps"/>
</genClasses>
</genPackages>
</genmodel:GenModel>
Loading

0 comments on commit 0e508b2

Please sign in to comment.