Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/Eval.java22
-rw-r--r--plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/AbstractEEFController.java4
-rw-r--r--tests/org.eclipse.eef.tests/META-INF/MANIFEST.MF5
-rw-r--r--tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Help.xmi18
-rw-r--r--tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Label.xmi17
-rw-r--r--tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Value.xmi16
-rw-r--r--tests/org.eclipse.eef.tests/data/dart.ecore169
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AQLInterpreter.java115
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AllTests.java2
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFDataTests.java88
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFTestServices.java35
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java179
12 files changed, 576 insertions, 94 deletions
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/Eval.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/Eval.java
index 68f398e03..75715a0d1 100644
--- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/Eval.java
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/Eval.java
@@ -81,7 +81,7 @@ public final class Eval {
public <T> void call(EAttribute expressionEAttribute, String expression, Class<T> expectedResultType, ISuccessfulResultConsumer<T> consumer) {
if (!Util.isBlank(expression)) {
this.call(expression, expectedResultType, consumer);
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
EEFCorePlugin.getPlugin().blank(expressionEAttribute);
}
}
@@ -99,18 +99,22 @@ public final class Eval {
* The type of the result expected
*/
public <T> void call(String expression, Class<T> expectedResultType, ISuccessfulResultConsumer<T> consumer) {
+ if (Util.isBlank(expression)) {
+ return;
+ }
+
IEvaluationResult evaluationResult = this.interpreter.evaluateExpression(this.variables, expression);
if (evaluationResult.success()) {
Object value = evaluationResult.getValue();
if (expectedResultType.isInstance(value) || (value == null && !expectedResultType.isPrimitive())) {
T castValue = expectedResultType.cast(value);
consumer.apply(castValue);
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
String message = MessageFormat.format(Messages.AbstractEEFWidgetController_InvalidValueForExpression, expression,
expectedResultType.getName(), value);
EEFCorePlugin.getPlugin().error(message);
}
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
EEFCorePlugin.getPlugin().diagnostic(expression, evaluationResult.getDiagnostic());
}
}
@@ -128,7 +132,7 @@ public final class Eval {
public void call(EAttribute expressionEAttribute, String expression, ISuccessfulResultConsumer<Object> consumer) {
if (!Util.isBlank(expression)) {
this.call(expression, consumer);
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
EEFCorePlugin.getPlugin().blank(expressionEAttribute);
}
}
@@ -146,7 +150,7 @@ public final class Eval {
if (evaluationResult.success()) {
Object value = evaluationResult.getValue();
consumer.apply(value);
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
EEFCorePlugin.getPlugin().diagnostic(expression, evaluationResult.getDiagnostic());
}
}
@@ -165,7 +169,7 @@ public final class Eval {
if (!evaluationResult.success()) {
EEFCorePlugin.getPlugin().diagnostic(expression, evaluationResult.getDiagnostic());
}
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
EEFCorePlugin.getPlugin().blank(expressionEAttribute);
}
}
@@ -192,15 +196,15 @@ public final class Eval {
if (expectedResultType.isInstance(value) || (value == null && !expectedResultType.isPrimitive())) {
T castValue = expectedResultType.cast(value);
return castValue;
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
String message = MessageFormat.format(Messages.AbstractEEFWidgetController_InvalidValueForExpression, expression,
expectedResultType.getName(), value);
EEFCorePlugin.getPlugin().error(message);
}
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
EEFCorePlugin.getPlugin().diagnostic(expression, evaluationResult.getDiagnostic());
}
- } else {
+ } else if (EEFCorePlugin.getPlugin() != null) {
EEFCorePlugin.getPlugin().blank(expressionEAttribute);
}
return null;
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/AbstractEEFController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/AbstractEEFController.java
index 58cad5662..ec103bb7f 100644
--- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/AbstractEEFController.java
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/AbstractEEFController.java
@@ -98,7 +98,9 @@ public abstract class AbstractEEFController implements IEEFController {
public void refresh() {
List<IValidationRuleResult> validationRuleResults = this.getValidationRuleResults(this.getValidationRulesContainer(),
this.getValidationRulesReference());
- this.validationConsumer.apply(validationRuleResults);
+ if (this.validationConsumer != null) {
+ this.validationConsumer.apply(validationRuleResults);
+ }
}
/**
diff --git a/tests/org.eclipse.eef.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.eef.tests/META-INF/MANIFEST.MF
index 83a1cd93a..7e45042b5 100644
--- a/tests/org.eclipse.eef.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.eef.tests/META-INF/MANIFEST.MF
@@ -13,4 +13,7 @@ Require-Bundle: org.junit;bundle-version="[4.12.0,5.0.0)",
org.eclipse.eef.core;bundle-version="[1.6.0,2.0.0)",
org.eclipse.emf.transaction;bundle-version="[1.9.0,2.0.0)",
org.eclipse.sirius.common.interpreter;bundle-version="[4.0.0,5.0.0)",
- org.eclipse.emf.ecore.xmi;bundle-version="[2.8.0,3.0.0)"
+ org.eclipse.emf.ecore.xmi;bundle-version="[2.8.0,3.0.0)",
+ org.eclipse.acceleo.query;bundle-version="[5.0.0,6.0.0)",
+ org.antlr.runtime;bundle-version="4.3.0"
+Import-Package: com.google.common.cache;version="[15.0.0,16.0.0)"
diff --git a/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Help.xmi b/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Help.xmi
new file mode 100644
index 000000000..e47bbdadb
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Help.xmi
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="ASCII"?>
+<eef:EEFViewDescription
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:eef="http://www.eclipse.org/eef"
+ xsi:schemaLocation="http://www.eclipse.org/eef ../../../../org.eclipse.eef/model/eef.ecore">
+ <groups>
+ <container>
+ <widgets
+ xsi:type="eef:EEFTextDescription"
+ labelExpression=""
+ helpExpression="aql:'Project Help'"
+ valueExpression=""/>
+ </container>
+ </groups>
+ <pages groups="//@groups.0"/>
+</eef:EEFViewDescription>
diff --git a/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Label.xmi b/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Label.xmi
new file mode 100644
index 000000000..c1cb5b7be
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Label.xmi
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ASCII"?>
+<eef:EEFViewDescription
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:eef="http://www.eclipse.org/eef"
+ xsi:schemaLocation="http://www.eclipse.org/eef ../../../../org.eclipse.eef/model/eef.ecore">
+ <groups>
+ <container>
+ <widgets
+ xsi:type="eef:EEFTextDescription"
+ labelExpression="aql:self.name.toUpperFirst() + ':'"
+ valueExpression=""/>
+ </container>
+ </groups>
+ <pages groups="//@groups.0"/>
+</eef:EEFViewDescription>
diff --git a/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Value.xmi b/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Value.xmi
new file mode 100644
index 000000000..5fb060d8a
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/data/controllers/text/EEFTextControllerTests-Value.xmi
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ASCII"?>
+<eef:EEFViewDescription
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:eef="http://www.eclipse.org/eef"
+ xsi:schemaLocation="http://www.eclipse.org/eef ../../../../org.eclipse.eef/model/eef.ecore">
+ <groups>
+ <container>
+ <widgets
+ xsi:type="eef:EEFTextDescription"
+ valueExpression="aql:self.name"/>
+ </container>
+ </groups>
+ <pages groups="//@groups.0"/>
+</eef:EEFViewDescription>
diff --git a/tests/org.eclipse.eef.tests/data/dart.ecore b/tests/org.eclipse.eef.tests/data/dart.ecore
new file mode 100644
index 000000000..fb198697c
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/data/dart.ecore
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="dart" nsURI="http://www.obeo.fr/dsl/2014/dart" nsPrefix="dart">
+ <eClassifiers xsi:type="ecore:EClass" name="Project">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="packages" upperBound="-1"
+ eType="#//Package" containment="true" eOpposite="#//Package/project"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Asset">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="container" eType="#//Container"
+ eOpposite="#//Container/assets"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Container" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="assets" upperBound="-1"
+ eType="#//Asset" containment="true" eOpposite="#//Asset/container"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Folder" eSuperTypes="#//Container #//Asset"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Package" eSuperTypes="#//Container">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="license" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="dependencies" upperBound="-1"
+ eType="#//Package"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="project" eType="#//Project"
+ eOpposite="#//Project/packages"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="DartResource" abstract="true" eSuperTypes="#//Asset">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="documentation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="imports" upperBound="-1"
+ eType="#//Import" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="exports" upperBound="-1"
+ eType="#//Export" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Import">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="dartResource" eType="#//DartResource"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="as" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="show" upperBound="-1" eType="#//DartResource"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="hide" upperBound="-1" eType="#//DartResource"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Export">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="dartResource" eType="#//DartResource"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="show" upperBound="-1" eType="#//DartResource"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="hide" upperBound="-1" eType="#//DartResource"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Type" abstract="true" interface="true"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Library" eSuperTypes="#//DartResource">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="parts" upperBound="-1"
+ eType="#//Part" eOpposite="#//Part/partOf"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="typedefs" upperBound="-1"
+ eType="#//Typedef" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="variables" upperBound="-1"
+ eType="#//Variable" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="functions" upperBound="-1"
+ eType="#//Function" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Part" abstract="true" eSuperTypes="#//DartResource">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="partOf" eType="#//Library"
+ eOpposite="#//Library/parts"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Classifier" abstract="true" eSuperTypes="#//Part">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="fields" upperBound="-1"
+ eType="#//Variable" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Metadata" eSuperTypes="#//Classifier"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Class" eSuperTypes="#//Classifier #//Type">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="abstract" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="extends" eType="#//Class"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="implements" upperBound="-1"
+ eType="#//Class"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="mixins" upperBound="-1"
+ eType="#//Class"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="constructors" upperBound="-1"
+ eType="#//Constructor" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="methods" upperBound="-1"
+ eType="#//Function" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Variable">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="documentation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//Type"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="static" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="constant" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="final" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Constructor">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="constant" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="body" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Function">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="documentation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//Type"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="abstract" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="static" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="body" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="parameters" upperBound="-1"
+ eType="#//Parameter" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Parameter">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="optional" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//Type"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Typedef" eSuperTypes="#//Type">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="documentation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="#//Type"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="parameters" upperBound="-1"
+ eType="#//Parameter" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" upperBound="-1"
+ eType="#//Metadata"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="HTML" eSuperTypes="#//Asset">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="uses" upperBound="-1" eType="#//Asset"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Stylesheet" eSuperTypes="#//Asset">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="imports" upperBound="-1"
+ eType="#//Stylesheet"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="partial" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+ volatile="true" unsettable="true" derived="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Module" eSuperTypes="#//Part">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="types" upperBound="-1"
+ eType="#//AngularType"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="routes" upperBound="-1"
+ eType="#//Route" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AngularType" abstract="true" interface="true"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Controller" eSuperTypes="#//Class #//AngularType">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="publishAs" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="selector" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Component" eSuperTypes="#//Class #//AngularType">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="publishAs" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="stylesheet" eType="#//Stylesheet"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="template" eType="#//HTML"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="selector" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Decorator" eSuperTypes="#//Class #//AngularType">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="selector" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Formatter" eSuperTypes="#//Class #//AngularType">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="formatterName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Route">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="view" eType="#//HTML"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="extends" eType="#//Route"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AQLInterpreter.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AQLInterpreter.java
new file mode 100644
index 000000000..542e9d489
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AQLInterpreter.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.eef.tests.internal;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+
+import org.eclipse.acceleo.query.runtime.EvaluationResult;
+import org.eclipse.acceleo.query.runtime.IQueryBuilderEngine;
+import org.eclipse.acceleo.query.runtime.IQueryBuilderEngine.AstResult;
+import org.eclipse.acceleo.query.runtime.IQueryEnvironment;
+import org.eclipse.acceleo.query.runtime.IQueryEvaluationEngine;
+import org.eclipse.acceleo.query.runtime.Query;
+import org.eclipse.acceleo.query.runtime.QueryEvaluation;
+import org.eclipse.acceleo.query.runtime.QueryParsing;
+import org.eclipse.acceleo.query.runtime.ServiceUtils;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
+import org.eclipse.sirius.common.interpreter.api.IEvaluationResult;
+import org.eclipse.sirius.common.interpreter.api.IInterpreter;
+
+/**
+ * An AQL interpreter used for tests.
+ *
+ * @author sbegaudeau
+ */
+public class AQLInterpreter implements IInterpreter {
+
+ /**
+ * The prefix used by AQL expressions.
+ */
+ private static final String AQL_PREFIX = "aql:"; //$NON-NLS-1$
+
+ /**
+ * The cache of the expressions parsed.
+ */
+ private LoadingCache<String, AstResult> parsedExpressions;
+
+ /**
+ * The query environment.
+ */
+ private IQueryEnvironment queryEnvironment;
+
+ /**
+ * The constructor.
+ */
+ public AQLInterpreter() {
+ this.queryEnvironment = Query.newEnvironmentWithDefaultServices(null);
+ this.queryEnvironment.registerEPackage(EcorePackage.eINSTANCE);
+ ServiceUtils.registerServices(this.queryEnvironment, ServiceUtils.getServices(this.queryEnvironment, EEFTestServices.class));
+ this.queryEnvironment.registerCustomClassMapping(EcorePackage.eINSTANCE.getEStringToStringMapEntry(), EStringToStringMapEntryImpl.class);
+ initExpressionsCache();
+ }
+
+ /**
+ * Initializes the cache of the expressions.
+ */
+ private void initExpressionsCache() {
+ final IQueryBuilderEngine builder = QueryParsing.newBuilder(queryEnvironment);
+ final int maxCacheSize = 500;
+ this.parsedExpressions = CacheBuilder.newBuilder().maximumSize(maxCacheSize).build(new CacheLoader<String, AstResult>() {
+ @Override
+ public AstResult load(String key) throws Exception {
+ return builder.build(key);
+ }
+
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.sirius.common.interpreter.api.IInterpreter#evaluateExpression(java.util.Map, java.lang.String)
+ */
+ @Override
+ public IEvaluationResult evaluateExpression(Map<String, Object> variables, String expressionBody) {
+ String expression = expressionBody;
+ if (expression.startsWith(AQL_PREFIX)) {
+ expression = expression.substring(AQL_PREFIX.length());
+ }
+
+ try {
+ AstResult build = parsedExpressions.get(expression);
+ IQueryEvaluationEngine evaluationEngine = QueryEvaluation.newEngine(queryEnvironment);
+ final EvaluationResult evalResult = evaluationEngine.eval(build, variables);
+
+ final BasicDiagnostic diagnostic = new BasicDiagnostic();
+ if (Diagnostic.OK != build.getDiagnostic().getSeverity()) {
+ diagnostic.merge(build.getDiagnostic());
+ }
+ if (Diagnostic.OK != evalResult.getDiagnostic().getSeverity()) {
+ diagnostic.merge(evalResult.getDiagnostic());
+ }
+
+ return org.eclipse.sirius.common.interpreter.api.EvaluationResult.of(evalResult.getResult(), diagnostic);
+ } catch (ExecutionException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+}
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AllTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AllTests.java
index 3f42caeff..af55a2f98 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AllTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/AllTests.java
@@ -21,7 +21,7 @@ import org.junit.runners.Suite.SuiteClasses;
* @author sbegaudeau
*/
@RunWith(Suite.class)
-@SuiteClasses({ EEFTextControllerTests.class })
+@SuiteClasses({ EEFDataTests.class, EEFTextControllerTests.class })
public final class AllTests {
/**
* The constructor.
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFDataTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFDataTests.java
new file mode 100644
index 000000000..71feef781
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFDataTests.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.eef.tests.internal;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.eclipse.eef.EefPackage;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsNull.notNullValue;
+
+import static org.junit.Assert.fail;
+
+/**
+ * This test is used to make sure that all the models used are available.
+ *
+ * @author sbegaudeau
+ */
+@SuppressWarnings({ "checkstyle:javadocmethod" })
+public class EEFDataTests {
+ /**
+ * Test model used to display the label of a text widget.
+ */
+ public static final String EEFTEXTCONTROLLERTESTS_LABEL = "/data/controllers/text/EEFTextControllerTests-Label.xmi"; //$NON-NLS-1$
+
+ /**
+ * Test model used to compute the value of the text widget using the structural feature name.
+ */
+ public static final String EEFTEXTCONTROLLERTESTS_VALUE = "/data/controllers/text/EEFTextControllerTests-Value.xmi"; //$NON-NLS-1$
+
+ /**
+ * Test model used to compute the help of a text widget.
+ */
+ public static final String EEFTEXTCONTROLLERTESTS_HELP = "/data/controllers/text/EEFTextControllerTests-Help.xmi"; //$NON-NLS-1$
+
+ /**
+ * The current directory.
+ */
+ public static final String CURRENTDIR = System.getProperty("user.dir"); //$NON-NLS-1$
+
+ /**
+ * All the test models.
+ */
+ private static final String[] MODELS = new String[] { EEFTEXTCONTROLLERTESTS_LABEL, EEFTEXTCONTROLLERTESTS_VALUE, EEFTEXTCONTROLLERTESTS_HELP, };
+
+ /**
+ * Loads the resource with the given URI in the given resource set.
+ *
+ * @param resourceSet
+ * The resource set
+ * @param uri
+ * The uri
+ * @return The resource loaded or <code>null</code> if none could be found
+ */
+ public static Resource loadResource(ResourceSet resourceSet, URI uri) {
+ resourceSet.getPackageRegistry().put(EefPackage.eNS_URI, EefPackage.eINSTANCE);
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl()); //$NON-NLS-1$
+ return resourceSet.getResource(uri, true);
+ }
+
+ @Test
+ public void testAvailableModels() {
+ Arrays.stream(MODELS).map(model -> URI.createFileURI(CURRENTDIR + model)).forEach(uri -> {
+ Resource resource = EEFDataTests.loadResource(new ResourceSetImpl(), uri);
+ assertThat(resource, notNullValue());
+ try {
+ resource.load(null);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ });
+ }
+}
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFTestServices.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFTestServices.java
new file mode 100644
index 000000000..580fa32e3
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/EEFTestServices.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.eef.tests.internal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * Utility services for tests.
+ *
+ * @author sbegaudeau
+ */
+public class EEFTestServices {
+ /**
+ * Sets the value of the given structural feature for the given EObject.
+ *
+ * @param eObject
+ * The EObject
+ * @param eStructuralFeature
+ * The structural feature
+ * @param newValue
+ * The new value
+ */
+ public void eSet(EObject eObject, EStructuralFeature eStructuralFeature, Object newValue) {
+ eObject.eSet(eStructuralFeature, newValue);
+ }
+}
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java
index 56fca7160..c75467c60 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java
@@ -10,26 +10,32 @@
*******************************************************************************/
package org.eclipse.eef.tests.internal.controllers;
-import java.util.Map;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+import org.eclipse.eef.EEFGroupDescription;
+import org.eclipse.eef.EEFPageDescription;
import org.eclipse.eef.EEFTextDescription;
-import org.eclipse.eef.EefFactory;
+import org.eclipse.eef.EEFViewDescription;
+import org.eclipse.eef.EEFWidgetDescription;
+import org.eclipse.eef.EefPackage;
import org.eclipse.eef.core.api.EEFExpressionUtils;
import org.eclipse.eef.core.api.controllers.IEEFTextController;
import org.eclipse.eef.core.internal.controllers.EEFTextController;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.eef.tests.internal.AQLInterpreter;
+import org.eclipse.eef.tests.internal.EEFDataTests;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
-import org.eclipse.sirius.common.interpreter.api.EvaluationResult;
import org.eclipse.sirius.common.interpreter.api.IInterpreter;
import org.eclipse.sirius.common.interpreter.api.IVariableManager;
import org.eclipse.sirius.common.interpreter.api.VariableManagerFactory;
@@ -37,7 +43,10 @@ import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+
+import static org.junit.Assert.assertTrue;
/**
* Unit tests for the {@link IEEFTextController}.
@@ -47,115 +56,121 @@ import static org.hamcrest.core.IsEqual.equalTo;
@SuppressWarnings({ "checkstyle:javadocmethod" })
public class EEFTextControllerTests {
/**
- * The editing domain.
+ * The path of the dart.ecore file.
*/
- private TransactionalEditingDomainImpl editingDomain;
+ private static final String DART_ECORE = "/data/dart.ecore"; //$NON-NLS-1$
/**
- * The description.
+ * The name of the Project EClass.
*/
- private EEFTextDescription description;
+ private static final String PROJECT_ECLASS_NAME = "Project"; //$NON-NLS-1$
/**
- * The variable manager.
+ * The editing domain.
*/
- private IVariableManager variableManager;
+ private TransactionalEditingDomainImpl editingDomain;
/**
* The resource set.
*/
private ResourceSetImpl resourceSet;
+ /**
+ * The interpreter.
+ */
+ private IInterpreter interpreter;
+
@Before
public void setUp() {
- AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
this.resourceSet = new ResourceSetImpl();
- this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
- .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
- this.editingDomain = new TransactionalEditingDomainImpl(adapterFactory, this.resourceSet);
- this.variableManager = new VariableManagerFactory().createVariableManager();
+ this.resourceSet.getPackageRegistry().put(EefPackage.eNS_URI, EefPackage.eINSTANCE);
+ this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl()); //$NON-NLS-1$
+ this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl()); //$NON-NLS-1$
- this.description = EefFactory.eINSTANCE.createEEFTextDescription();
+ AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ this.editingDomain = new TransactionalEditingDomainImpl(adapterFactory, this.resourceSet);
- this.description.setLabelExpression("aql:'General'"); //$NON-NLS-1$
- this.description.setValueExpression("aql:self.name"); //$NON-NLS-1$
- this.description.setEditExpression("aql.self.eSet('name', newValue)"); //$NON-NLS-1$
+ this.interpreter = new AQLInterpreter();
}
- @Test
- public void testUpdateValue() {
- final String newValue = "newValue"; //$NON-NLS-1$
-
- IInterpreter interpreter = (Map<String, Object> variables, String expressionBody) -> {
- return EvaluationResult.of(newValue);
- };
-
- IEEFTextController controller = new EEFTextController(description, variableManager, interpreter, editingDomain);
- controller.onNewValue((text) -> {
- assertThat(text, equalTo(newValue));
- });
-
- controller.onNewLabel(newLabel -> {
- // do nothing
- });
-
- controller.onNewHelp(newHelp -> {
- // nothing
- });
+ private EEFViewDescription view(String modelPath) {
+ Resource resource = EEFDataTests.loadResource(this.resourceSet, URI.createFileURI(EEFDataTests.CURRENTDIR + modelPath));
+ assertThat(resource, notNullValue());
+ EObject eObject = resource.getContents().get(0);
+ if (eObject instanceof EEFViewDescription) {
+ EEFViewDescription eefViewDescription = (EEFViewDescription) eObject;
+ return eefViewDescription;
+ }
+ throw new IllegalStateException("The root of the model is not a view description"); //$NON-NLS-1$
+ }
- controller.onValidation(result -> {
- // nothing
- });
+ private EEFPageDescription page(String modelPath, int pageIndex) {
+ return this.view(modelPath).getPages().get(pageIndex);
+ }
- controller.refresh();
+ private EEFGroupDescription group(EEFPageDescription eefPageDescription, int groupIndex) {
+ return eefPageDescription.getGroups().get(groupIndex);
}
- @Test
- public void testUpdateValueWithEObject() {
- String name = "TestEClass"; //$NON-NLS-1$
+ private <T extends EEFWidgetDescription> T widget(EEFGroupDescription eefGroupDescription, Class<T> clazz, int widgetIndex) {
+ List<T> list = eefGroupDescription.getContainer().getWidgets().stream().filter(w -> clazz.isAssignableFrom(w.getClass()))
+ .map(w -> clazz.cast(w)).collect(Collectors.toList());
+ return list.get(widgetIndex);
+ }
- EClass eClass = EcoreFactory.eINSTANCE.createEClass();
- eClass.setName(name);
+ private EPackage ePackage(String modelPath, int ePackageIndex) {
+ Resource resource = EEFDataTests.loadResource(this.resourceSet, URI.createFileURI(EEFDataTests.CURRENTDIR + modelPath));
+ assertThat(resource, notNullValue());
+ EObject eObject = resource.getContents().get(0);
+ if (eObject instanceof EPackage) {
+ return (EPackage) eObject;
+ }
+ throw new IllegalStateException("The root of the model is not an EPackage"); //$NON-NLS-1$
+ }
- Resource resource = this.resourceSet.createResource(URI.createURI("test.ecore")); //$NON-NLS-1$
- Command command = new RecordingCommand(this.editingDomain) {
- @Override
- protected void doExecute() {
- resource.getContents().add(eClass);
- }
- };
+ private IEEFTextController textController(String modelPath) {
+ EClassifier eClassifier = this.ePackage(DART_ECORE, 0).getEClassifier(PROJECT_ECLASS_NAME);
- CommandStack commandStack = this.editingDomain.getCommandStack();
- commandStack.execute(command);
+ IVariableManager variableManager = new VariableManagerFactory().createVariableManager();
+ variableManager.put(EEFExpressionUtils.SELF, eClassifier);
- this.variableManager.getVariables().put(EEFExpressionUtils.SELF, eClass);
+ EEFTextDescription description = widget(group(page(modelPath, 0), 0), EEFTextDescription.class, 0);
+ return new EEFTextController(description, variableManager, this.interpreter, this.editingDomain);
}
@Test
- public void testUpdateLabel() {
- final String newLabel = "Label"; //$NON-NLS-1$
-
- IInterpreter interpreter = (Map<String, Object> variables, String expressionBody) -> {
- return EvaluationResult.of(newLabel);
- };
-
- IEEFTextController controller = new EEFTextController(description, variableManager, interpreter, editingDomain);
- controller.onNewLabel((label) -> {
- assertThat(label, equalTo(newLabel));
- });
-
- controller.onNewValue(newValue -> {
- // nothing
+ public void testLabel() {
+ AtomicBoolean atomicBoolean = new AtomicBoolean(false);
+ IEEFTextController controller = this.textController(EEFDataTests.EEFTEXTCONTROLLERTESTS_LABEL);
+ controller.onNewLabel(label -> {
+ assertThat(label, is("Project:")); //$NON-NLS-1$
+ atomicBoolean.set(true);
});
+ controller.refresh();
+ assertTrue(atomicBoolean.get());
+ }
- controller.onNewHelp(newHelp -> {
- // nothing
+ @Test
+ public void testValue() {
+ AtomicBoolean atomicBoolean = new AtomicBoolean(false);
+ IEEFTextController controller = this.textController(EEFDataTests.EEFTEXTCONTROLLERTESTS_VALUE);
+ controller.onNewValue(value -> {
+ assertThat(value, is(PROJECT_ECLASS_NAME));
+ atomicBoolean.set(true);
});
+ controller.refresh();
+ assertTrue(atomicBoolean.get());
+ }
- controller.onValidation(result -> {
- // nothing
+ @Test
+ public void testHelp() {
+ AtomicBoolean atomicBoolean = new AtomicBoolean(false);
+ IEEFTextController controller = this.textController(EEFDataTests.EEFTEXTCONTROLLERTESTS_HELP);
+ controller.onNewHelp(help -> {
+ assertThat(help, is("Project Help")); //$NON-NLS-1$
+ atomicBoolean.set(true);
});
-
controller.refresh();
+ assertTrue(atomicBoolean.get());
}
}

Back to the top