diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/.classpath b/plugins/org.etsi.mts.tdl.constraints.ui/.classpath
new file mode 100644
index 0000000000000000000000000000000000000000..098194ca4b7d8f45177f94e735506ae3a26b5c94
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/.project b/plugins/org.etsi.mts.tdl.constraints.ui/.project
new file mode 100644
index 0000000000000000000000000000000000000000..51bfcfeb0ea0c69c6df82351b72fc0228d4d2435
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/.project
@@ -0,0 +1,28 @@
+
+
+ org.etsi.mts.tdl.constraints.ui
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.etsi.mts.tdl.constraints.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000000000000000000000000000000000..f42de363afaae68bbd968318f1d331877f5514fc
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/META-INF/MANIFEST.MF b/plugins/org.etsi.mts.tdl.constraints.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000000000000000000000000000000000..8f56dad0e9e8c763a5344f74708f75ba3733a9d6
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Ui
+Bundle-SymbolicName: org.etsi.mts.tdl.constraints.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.etsi.mts.tdl.constraints.ui.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors;bundle-version="3.5.0",
+ org.eclipse.ui.ide;bundle-version="3.5.0",
+ org.eclipse.ui.workbench,
+ org.etsi.mts.tdl.constraints,
+ org.eclipse.epsilon.common,
+ org.eclipse.epsilon.emc.emf,
+ org.eclipse.epsilon.eol.engine,
+ org.eclipse.epsilon.erl.engine,
+ org.eclipse.epsilon.evl.engine,
+ org.eclipse.epsilon.evl.emf.validation,
+ org.eclipse.epsilon.etl.engine,
+ org.eclipse.epsilon.profiling,
+ org.eclipse.epsilon.eol.tools,
+ com.google.inject,
+ org.eclipse.xtext.ui
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/build.properties b/plugins/org.etsi.mts.tdl.constraints.ui/build.properties
new file mode 100644
index 0000000000000000000000000000000000000000..0d3d3a745d49c12500fb77bdc372b76e8bf624de
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/icons/ValidateIcon.png b/plugins/org.etsi.mts.tdl.constraints.ui/icons/ValidateIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..d7978842db3f0fca412a3a1b2d0e7ff980951836
Binary files /dev/null and b/plugins/org.etsi.mts.tdl.constraints.ui/icons/ValidateIcon.png differ
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/icons/sample.gif b/plugins/org.etsi.mts.tdl.constraints.ui/icons/sample.gif
new file mode 100644
index 0000000000000000000000000000000000000000..34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610
Binary files /dev/null and b/plugins/org.etsi.mts.tdl.constraints.ui/icons/sample.gif differ
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/plugin.xml b/plugins/org.etsi.mts.tdl.constraints.ui/plugin.xml
new file mode 100644
index 0000000000000000000000000000000000000000..baf5c5b24b54fd29c2399d12f3c64c7527fa29d4
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/plugin.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/Activator.java b/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/Activator.java
new file mode 100644
index 0000000000000000000000000000000000000000..b79a19d83b17ffaabc228624767b5d19ea73d7a7
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/Activator.java
@@ -0,0 +1,61 @@
+package org.etsi.mts.tdl.constraints.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.etsi.mts.tdl.constraints.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/.project b/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/.project
new file mode 100644
index 0000000000000000000000000000000000000000..b6e59aeba9ddff4fee3c1a4e3e4589e2703bb2cd
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/.project
@@ -0,0 +1 @@
+DUMMY
\ No newline at end of file
diff --git a/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/ValidationHandler.java b/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/ValidationHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..b4e5dc593afe9599f9ebe3b9115a173ba94f0246
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/ValidationHandler.java
@@ -0,0 +1,96 @@
+package org.etsi.mts.tdl.constraints.ui.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+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.epsilon.evl.execute.UnsatisfiedConstraint;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.xtext.ui.resource.IResourceSetProvider;
+import org.etsi.mts.tdl.constraints.evl.Validator;
+
+import com.google.inject.Inject;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class ValidationHandler extends AbstractHandler {
+ @Inject
+ IResourceSetProvider resourceSetProvider;
+
+ private IWorkbenchWindow window;
+
+ /**
+ * The constructor.
+ */
+ public ValidationHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ IEditorInput input = HandlerUtil.getActiveEditorInput(event);
+ IFile file = null;
+ IProject project = null;
+ if (input != null && input instanceof FileEditorInput) {
+ file = ((FileEditorInput) input).getFile();
+ project = file.getProject();
+ } else if (selection !=null && selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ Object firstElement = structuredSelection.getFirstElement();
+ if (firstElement instanceof IFile) {
+ file = (IFile) firstElement;
+ project = file.getProject();
+ }
+ }
+
+ if (file !=null) {
+ URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ ResourceSet rs = new ResourceSetImpl();
+ Resource r = rs.getResource(uri, true);
+ Validator validator = new Validator();
+ List violations = validator.validate(r);
+ String messages = "";
+ for (UnsatisfiedConstraint v : violations) {
+ messages += v.getMessage()+"\n";
+ }
+
+ if (violations.size() == 0) {
+ messages = "No violations!";
+ }
+ MessageDialog.openInformation(
+ Display.getDefault().getActiveShell(),
+// window.getShell(),
+ "Validation Results",
+ messages);
+ }
+ return null;
+ }
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
diff --git a/plugins/org.etsi.mts.tdl.constraints/.classpath b/plugins/org.etsi.mts.tdl.constraints/.classpath
new file mode 100644
index 0000000000000000000000000000000000000000..b27b15b37af15ee6c14368ccbaadda9b9b4811b0
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/plugins/org.etsi.mts.tdl.constraints/.project b/plugins/org.etsi.mts.tdl.constraints/.project
new file mode 100644
index 0000000000000000000000000000000000000000..3636cb64baec9c1cd76270ca92ea2749b48b1158
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/.project
@@ -0,0 +1,28 @@
+
+
+ org.etsi.mts.tdl.constraints
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/plugins/org.etsi.mts.tdl.constraints/.settings/org.eclipse.jdt.core.prefs b/plugins/org.etsi.mts.tdl.constraints/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000000000000000000000000000000000..f42de363afaae68bbd968318f1d331877f5514fc
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/plugins/org.etsi.mts.tdl.constraints/META-INF/MANIFEST.MF b/plugins/org.etsi.mts.tdl.constraints/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000000000000000000000000000000000..0d47c78176d95e1751f6b209219765f687269e1b
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Constraints
+Bundle-SymbolicName: org.etsi.mts.tdl.constraints
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.emf.common,
+ org.eclipse.epsilon.common,
+ org.eclipse.epsilon.emc.emf,
+ org.eclipse.epsilon.eol.engine,
+ org.eclipse.epsilon.erl.engine,
+ org.eclipse.epsilon.evl.engine,
+ org.eclipse.epsilon.evl.emf.validation,
+ org.eclipse.epsilon.etl.engine,
+ org.eclipse.epsilon.profiling,
+ org.eclipse.epsilon.eol.tools,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi,
+ org.etsi.mts.tdl.model
+Export-Package: org.etsi.mts.tdl.constraints.evl
diff --git a/plugins/org.etsi.mts.tdl.constraints/build.properties b/plugins/org.etsi.mts.tdl.constraints/build.properties
new file mode 100644
index 0000000000000000000000000000000000000000..34d2e4d2dad529ceaeb953bfcdb63c51d69ffed2
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.etsi.mts.tdl.constraints/epsilon/constraints/tdl.evl b/plugins/org.etsi.mts.tdl.constraints/epsilon/constraints/tdl.evl
new file mode 100644
index 0000000000000000000000000000000000000000..e911de1a05d3714e09f7f15fbbdaf41f98222537
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/epsilon/constraints/tdl.evl
@@ -0,0 +1,907 @@
+import "../library/common.eol";
+import "../library/helper.eol";
+import "../library/debug.eol";
+
+context NamedElement {
+//Constraints
+//Mandatory name
+ constraint MandatoryName {
+ check: not self.name.oclIsUndefined()
+ and self.name.size() > 0
+ message: self.prefix() + "A 'NamedElement' shall have the 'name' property set and the 'name' shall be not an empty String."
+ }
+//Distinguishable qualified names
+ constraint DistinguishableName {
+ //qualifiedName implementation pending, replace qualifiedName() with qualifiedName in end result
+ check: NamedElement.allInstances()->one(e | e.qualifiedName() = self.qualifiedName())
+ message: self.prefix() + "All qualified names of instances of the same meta-class shall be distinguishable within a TDL model."
+ }
+}
+
+context Package {
+//Constraints
+//No cyclic imports
+ constraint CyclicImports {
+ check: self.`import`->asOrderedSet()->closure(i | i.importedPackage.`import`)->forAll(i | i.importedPackage <> self)
+ message: self.prefix() + "A 'Package' shall not import itself directly or indirectly."
+ }
+}
+
+
+context ElementImport {
+//Constraints
+//Consistency of imported elements
+ constraint ConsistentImports {
+ check: self.importedElement->forAll(e | self.importedPackage.packagedElement->contains(e))
+ message: self.prefix() + "All imported 'PackageableElement's referenced by an 'ElementImport' shall be directly owned by the imported 'Package'."
+ }
+}
+
+context Comment {
+//Constraints
+//No nested comments
+ constraint CommentNestedComments {
+ check: self.comment->isEmpty()
+ message: self.prefix() + "A 'Comment' shall not contain 'Comment's."
+ }
+//No annotations to comments
+ constraint CommentNestedAnnotations {
+ check: self.annotation->isEmpty()
+ message: self.prefix() + "A 'Comment' shall not contain 'Annotation's."
+ }
+}
+
+context Annotation {
+//Constraints
+//No nested annotations
+ constraint AnnotationNestedComments {
+ check: self.annotation->isEmpty()
+ message: self.prefix() + "An 'Annotation' shall not contain 'Annotation's."
+ }
+//No comments to annotations
+ constraint AnnotationNestedComments {
+ check: self.comment->isEmpty()
+ message: self.prefix() + "An 'Annotation' shall not contain 'Comment's."
+ }
+}
+
+
+context DataElementMapping {
+//Constraints
+//Restricted use of parameter mapping
+ constraint ParameterMappingType {
+ check: self.parameterMapping.size() = 0
+ or (self.mappableDataElement.oclIsTypeOf(StructuredDataType)
+ and self.parameterMapping->forAll(p | self.mappableDataElement.member->contains(p.parameter)))
+ or (self.mappableDataElement.oclIsKindOf(Action)
+ and self.parameterMapping->forAll(p | self.mappableDataElement.formalParameter->contains(p.parameter)))
+ message: self.prefix() + "A set of 'ParameterMapping's shall only be provided if 'mappableDataElement' refers to a 'StructuredDataType', an 'Action' or a 'Function' definition and the 'mappableDataElement' contains the mapped 'Parameters'."
+ }
+}
+
+context SimpleDataInstance {
+//Constraints
+//SimpleDataInstance shall refer to SimpleDataType
+ constraint SimpleDataInstanceType {
+ check: self.dataType.oclIsKindOf(SimpleDataType)
+ message: self.prefix() + "The inherited reference 'dataType' from 'DataInstance' shall refer to instances of 'SimpleDataType' solely."
+ }
+}
+
+context StructuredDataType {
+//Constraints
+//Different member names in a structured data type
+ constraint DistinguishableMemberNames {
+ check: self.member->forAll(m | self.member->one(e | e.name = m.name))
+ message: self.prefix() + self.prefix()+"All 'Member' names of a 'StructuredDataType' shall be distinguishable."
+ }
+
+}
+
+context StructuredDataInstance {
+//Constraints
+//StructuredDataInstance shall refer to StructuredDataType
+ constraint StructuredDataInstanceType {
+ check: self.dataType.oclIsTypeOf(StructuredDataType)
+ message: self.prefix() + "The inherited reference 'dataType' from 'DataInstance' shall refer to instances of 'StructuredDataType' solely."
+ }
+//'Member' of the 'StructuredDataType'
+ constraint ExistingMemberOfDataType {
+ check: self.dataType.oclIsTypeOf(StructuredDataType) and self.memberAssignment->forAll(a | self.dataType.member->contains(a.member))
+ message: self.prefix() + "The referenced 'Member' shall be contained in the 'StructuredDataType' that the 'StructuredDataInstance', which contains this 'MemberAssignment', refers to."
+ }
+}
+
+context MemberAssignment {
+//Constraints
+//Type of a 'memberSpec' and 'Member' shall coincide
+ constraint MatchingMemberDataType {
+ check: self.memberSpec.getDataType() = self.member.dataType
+ message: self.prefix() + "The 'DataType' of the 'StaticDataUse' of 'memberSpec' shall coincide with the 'DataType' of the 'Member' of the 'MemberAssignment'."
+ }
+//Restricted use of 'OmitValue' for optional 'Member's only
+ constraint OmitValueUse {
+ check: (self.memberSpec.oclIsTypeOf(OmitValue)
+ or self.memberSpec.oclIsTypeOf(AnyValueOrOmit))
+ implies self.member.isOptional = true
+ message: self.prefix() + "A non-optional 'Member' shall have a 'StaticDataUse' specification assigned to it that is different from 'OmitValue' and 'AnyOrOmitValue'."
+ }
+//moved from StaticDataUse/DataInstanceUse
+//Static data use in structured data
+ constraint StructuredDataInstanceUse {
+ check: self.memberSpec.argument->forAll(a | a.dataUse.oclIsKindOf(StaticDataUse))
+ and self.memberSpec.argument->closure(a | a.dataUse.argument)->forAll(a|a.dataUse.oclIsKindOf(StaticDataUse))
+ message: self.prefix() + "If the 'memberSpec' refers to a 'StructuredDataInstance', all of its 'ParameterBinding's shall refer to 'StaticDataUse'."
+ }
+
+}
+
+
+context DataUse {
+//Constraints
+//DELETED, redundant, already covered under function call
+//No mixed use of 'Member' and 'FormalParameter' in 'argument' set
+//All 'ParameterBinding's that are referenced in the 'argument' set shall refer only to one kind of 'Member' or 'FormalParameter'.
+//Occurrence of 'argument' and 'reduction'
+ constraint ArgumentReductionLists {
+ //updated message from proposed change
+ check: self.argument.isEmpty() or self.reduction.isEmpty() or self.oclIsTypeOf(FunctionCall)
+ message: self.prefix() + "Only in case of a ‘FunctionCall' both the 'argument' list and the ‘reduction' list may be provided, otherwise either the 'argument' list, the ’reduction' list, or none of them shall be provided."
+ }
+//Structured data types in 'reduction' set
+//A 'Member' at index i of a 'reduction' shall be contained in the 'StructuredDataType' of the 'Member' at index(i - 1) of that 'reduction'.
+ constraint ReductionMembers {
+ check: not self.getDataType().isKindOf(StructuredDataType)
+ or self.reduction->isEmpty()
+ or self.getDataType().member->contains(self.reduction->first())
+ and self.reduction->select(m|
+ self.reduction->indexOf(m) > 0)->forAll(m|
+ self.reduction->at(self.reduction->indexOf(m)-1).dataType.isKindOf(StructuredDataType)
+ and self.reduction->at(self.reduction->indexOf(m)-1).dataType.member->contains(m))
+ message: self.prefix() + "A 'Member' at index i of a 'reduction' shall be contained in the 'StructuredDataType' of the 'Member' at index(i - 1) of that 'reduction'."
+ }
+
+}
+
+context ParameterBinding {
+//Constraints
+//Matching data type
+ constraint ParameterBindingTypes {
+ check: self.dataUse.getDataType() = self.parameter.dataType
+ message: self.prefix() + "The provided 'DataUse' shall match the 'DataType' of the referenced 'Parameter'."
+ }
+//Use of a 'StructuredDataInstance' with non-optional 'Member's
+ constraint OmitValueParameter {
+ check: self.parameter.oclIsTypeOf(Member)
+ and self.parameter.oclAsType(Member).isOptional = false implies not self.dataUse.oclIsTypeOf(OmitValue) and not self.dataUse.oclIsTypeOf(AnyValueOrOmit)
+ message: self.prefix() + "A non-optional 'Member' of a 'StructuredDataType' shall have a 'DataUse' specification assigned to it that is different from 'OmitValue'."
+ }
+
+}
+
+
+context DataInstanceUse {
+//Constraints
+//Either argument list or reduction list provided
+// constraint DataInstanceUseArgumentReduction {
+// check: self.argument->isEmpty() or self.reduction->isEmpty()
+// message: "Either one of the 'argument' list or 'reduction' list or none of them shall be provided."
+// }
+
+//Moved
+//Static data use in structured data
+ //constraint StructuredDataInstanceUse {
+ //check: self.dataInstance.oclIsTypeOf(StructuredDataInstance) implies self.argument->forAll(a | a.dataUse.oclIsTypeOf(StaticDataUse))
+ //message: self.prefix() + "If the 'DataInstance' refers to a 'StructuredDataInstance', all of its 'ParameterBinding's shall refer to 'StaticDataUse'."
+ //}
+
+ constraint DataInstanceOrArguments {
+ check: not self.dataInstance.oclIsUndefined() or not self.argument->isEmpty()
+ message: self.prefix() + "Either a 'dataInstance' or a non-empty 'argument' set shall be specified."
+ }
+
+ constraint DataTypeInInteraction {
+ check: (self.container().oclIsTypeOf(Interaction)
+ and self.dataInstance.oclIsUndefined()
+ and not self.dataType.oclIsUndefined())
+ or (self.container().oclIsTypeOf(Interaction)
+ and self.dataType.oclIsUndefined()
+ and not self.dataInstance.oclIsUndefined())
+ or (self.dataType.oclIsUndefined()
+ and not self.container().oclIsTypeOf(Interaction))
+ message: self.prefix() + "The 'dataType' property shall be provided only if the 'DataInstanceUse' is directly contained in an 'Interaction' and no 'DataInstance' is referenced."
+ }
+}
+
+context SpecialValueUse {
+//Constraints
+//Empty 'argument' and 'reduction' sets
+ constraint SpecialValueUseArgumentReduction {
+ //updated according to the discussion in Budapest
+ // - AnyValue shall permit the optional
+ // specification of arguments in case dataType is present (for use in interactions)
+ // - AnyValue and AnyValueOrOmit shall permit the optional
+ // specification of arguments
+ check: self.argument->isEmpty()
+ and self.reduction->isEmpty()
+ message: self.prefix() + "The 'argument' and 'reduction' sets shall be empty."
+ }
+}
+
+context AnyValue {
+//Constraints
+//Empty 'argument' and 'reduction' sets
+// constraint AnyValueArgumentReduction {
+ //updated according to the discussion in Budapest
+ // - AnyValue shall permit the optional
+ // specification of arguments in case dataType is present (for use in interactions)
+ // - AnyValue and AnyValueOrOmit shall permit the optional
+ // specification of arguments
+// check: self.reduction->isEmpty()
+// message: self.prefix() + "The 'reduction' set shall be empty."
+ //a separate constraint under interaction where the dataType shall be required in case arguments are provided, see Interaction
+// }
+}
+
+context AnyValueOrOmit {
+//Constraints
+//Empty 'argument' and 'reduction' sets
+// constraint AnyValueOrOmitArgumentReduction {
+ //updated according to the discussion in Budapest
+ // - AnyValue shall permit the optional
+ // specification of arguments in case dataType is present (for use in interactions)
+ // - AnyValue and AnyValueOrOmit shall permit the optional
+ // specification of arguments
+// check: self.reduction->isEmpty()
+// message: self.prefix() + "The 'reduction' set shall be empty."
+// }
+}
+
+context OmitValue {
+//Constraints
+//Empty 'argument' and 'reduction' sets
+// constraint OmitValueArgumentReduction {
+ //updated according to the discussion in Budapest
+ // - AnyValue shall permit the optional
+ // specification of arguments in case dataType is present (for use in interactions)
+ // - AnyValue and AnyValueOrOmit shall permit the optional
+ // specification of arguments
+// check: self.argument->isEmpty()
+// and self.reduction->isEmpty()
+// message: self.prefix() + "The 'argument' and 'reduction' sets shall be empty."
+// }
+}
+
+
+
+context FunctionCall {
+//Constraints
+//Matching parameters
+ constraint FunctionCallParameters {
+ check: self.`function`.formalParameter->forAll(p|self.argument->exists(a|a.parameter = p))
+ message: self.prefix() + "All 'FormalParameter's of the 'Function' shall be bound."
+ }
+}
+
+context FormalParameterUse {
+//Constraints
+//Either argument list or reduction list provided
+// constraint FormalParameterUseArgumentReduction {
+// check: self.argument->isEmpty()
+// or self.reduction->isEmpty()
+// message: self.prefix()+"Either one of the 'argument' list or 'reduction' list or none of them shall be provided."
+// }
+}
+
+
+context VariableUse {
+//Constraints
+//Either argument list or reduction list provided
+// constraint VariableUseArgumentReduction {
+// check: self.argument->isEmpty()
+// or self.reduction->isEmpty()
+// message: self.prefix()+"Either one of the 'argument' list or 'reduction' list or none of them shall be provided."
+// }
+//Local variables of tester components only
+ constraint VariableUseComponentRole {
+ check: self.componentInstance.type.variable->contains(self.variable)
+ and self.componentInstance.role.name = 'Tester'
+ message: self.prefix()+"All variables used in a 'DataUse' specification via a 'VariableUse' shall be local to the same 'componentInstance' and the 'componentInstance' shall be in the role 'Tester'."
+ }
+
+}
+
+
+context TimeLabelUse {
+//Constraints
+//Empty argument and reduction lists
+// constraint TimeLabelUseArgumentReduction {
+ //not the same as above
+// check: self.argument->isEmpty()
+// and self.reduction->isEmpty()
+// message: self.prefix()+"The 'argument' and 'reduction' lists shall be empty."
+// }
+
+}
+
+
+context TimeConstraint {
+//Constraints
+//Time constraint expression of type Boolean
+ constraint TimeConstraintType {
+ check: self.timeConstraintExpression.getDataType().name = 'Boolean'
+ message: self.prefix()+ "The expression given in the 'DataUse' specification shall evaluate to predefined type 'Boolean'."
+ }
+
+
+//Use of local variables only
+// The expression given in the 'DataUse' specification shall contain only 'Variable's that are local to the 'AtomicBehaviour' that contains this time constraint. That is, all 'Variable's shall be referenced in the 'ComponentInstance' that executes the 'AtomicBehaviour'.
+ constraint TimeConstraintVariables {
+ //interaction: sourceGate.component, target.targetGate.component
+ //actionBehaviour.componentInstance[0..1]
+ check: (not self.timeConstraintExpression.oclIsKindOf(VariableUse)
+ or (self.container().oclIsKindOf(Interaction)
+ and (self.container().sourceGate.component = self.timeConstraintExpression.componentInstance
+ or self.container().target->forAll(t |
+ t.targetGate.component = self.timeConstraintExpression.componentInstance)))
+ or (self.container().oclIsKindOf(ActionBehaviour)
+ and not self.container().componentInstance.oclIsUndefined()
+ and self.container().componentInstance = self.timeConstraintExpression.componentInstance))
+
+ and self.timeConstraintExpression.argument->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.container().oclIsKindOf(Interaction)
+ and (self.container().sourceGate.component = a.dataUse.componentInstance
+ or self.container().target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+ or (self.container().oclIsKindOf(ActionBehaviour)
+ and not self.container().componentInstance.oclIsUndefined()
+ and self.container().componentInstance = self.timeConstraintExpression.componentInstance))
+
+ and self.timeConstraintExpression.argument->closure(a | a.dataUse.argument)->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.container().oclIsKindOf(Interaction)
+ and (self.container().sourceGate.component = a.dataUse.componentInstance
+ or self.container().target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+ or (self.container().oclIsKindOf(ActionBehaviour)
+ and not self.container().componentInstance.oclIsUndefined()
+ and self.container().componentInstance = self.timeConstraintExpression.componentInstance))
+
+ message: self.prefix()+ "The expression given in the 'DataUse' specification shall contain only 'Variable's that are local to the 'AtomicBehaviour' that contains this time constraint. That is, all 'Variable's shall be referenced in the 'ComponentInstance' that executes the 'AtomicBehaviour'."
+ }
+
+}
+
+context TimeOperation {
+//Constraints
+//Time operations on tester components only
+ constraint TimeOperationComponentRole {
+ check: (not self.componentInstance.oclIsUndefined()
+ and self.componentInstance.role.name = 'Tester')
+ or (self.oclIsTypeOf(Quiescence)
+ and not self.gateReference.oclIsUndefined()
+ and self.gateReference.component.role.name = 'Tester')
+ message: self.prefix()+ "A 'TimeOperation' shall be performed only on a 'ComponentInstance' in the role 'Tester'."
+ }
+//'Time' data type for period expression
+ constraint TimePeriodType {
+ check: self.period.getDataType().oclIsKindOf(Time)
+ message: self.prefix()+ "The 'DataUse' expression assigned to the 'period' shall evaluate to a data instance of the 'Time' data type."
+ }
+}
+
+//context Wait {
+//removed
+//Constraints
+//Tester component for 'Wait' shall be known
+ //constraint WaitTarget {
+ //check: (not self.componentInstance.oclIsUndefined()) and self.componentInstance.role = Tester
+ //message: "The relation to a 'ComponentInstance' of a 'Wait' shall be set and refer to a 'Tester' component instance."
+ //}
+//}
+
+context Quiescence {
+//Constraints
+//Exclusive use of gate reference or component instance
+ constraint QuiescenceTarget {
+ check: self.gateReference.oclIsUndefined() or self.componentInstance.oclIsUndefined()
+ message: self.prefix()+ "If a 'GateReference' is provided, a 'ComponentInstance' shall be not provided and vice versa."
+ }
+}
+
+context Timer {
+//removed
+//Constraints
+//Initial state of a timerWhen a timer is defined, it is operationally in the state idle.
+}
+
+
+context TimerOperation {
+//Constraints
+//Timer operations on tester components only
+ constraint TimerOperationComponentRole {
+ check: self.componentInstance.role.name = 'Tester'
+ message: self.prefix()+ "A 'TimerOperation' shall be performed only on a 'ComponentInstance' in the role 'Tester'."
+ }
+
+}
+
+context TimerStart {
+//Constraints
+//'Time' data type for period expression
+ constraint TimerPeriodType {
+ check: self.period.getDataType().oclIsKindOf(Time)
+ message: self.prefix()+ "The 'DataUse' expression assigned to the 'period' shall evaluate to a data instance of the 'Time' data type."
+ }
+}
+
+context GateReference {
+//Constraints
+//Gate instance of the referred component instance
+ constraint GateInstanceReference {
+ check: self.component.type.gateInstance->contains(self.gate)
+ message: self.prefix()+ "The referred 'GateInstance' shall be contained in the 'ComponentType' of the referred 'ComponentInstance'."
+ }
+}
+
+context Connection {
+//Constraints
+//Self-loop connections are not permitted
+ constraint NoSelfLoop {
+ check: self.endPoint->forAll(e1 | self.endPoint->one(e2 |
+ e1.gate = e2.gate
+ and e1.component = e2.component))
+ message: self.prefix()+"The 'endPoint's of a 'Connection' shall not be the same. Two endpoints are the same if both, the referred 'ComponentInstance's and the referred 'GateInstance's, are identical."
+ }
+//Consistent type of a connection
+ constraint ConsistentConnectionType {
+ check: self.endPoint->at(0).gate.type = self.endPoint->at(1).gate.type
+ message: self.prefix()+"The 'GateInstance's of the two 'endPoint's of a 'Connection' shall refer to the same 'GateType'."
+ }
+
+}
+
+
+context TestConfiguration {
+//Constraints
+//'TestConfiguration' and components roles
+ constraint ComponentRoles {
+ check: self.componentInstance->exists(c | c.role.name = 'Tester')
+ and self.componentInstance->exists(c | c.role.name = 'SUT')
+ message: self.prefix()+"A 'TestConfiguration' shall contain at least one 'Tester' and one 'SUT' 'ComponentInstance'."
+ }
+//Only 'Connection's between own 'ComponentInstance's
+ constraint OwnedComponents {
+ check: self.connection->forAll(c |
+ self.componentInstance->contains(c.endPoint->at(0).component)
+ and self.componentInstance->contains(c.endPoint->at(1).component))
+ message: self.prefix()+"A 'TestConfiguration' shall only contain 'Connection's between gates of its own 'ComponentInstance's."
+ }
+
+
+//Minimal 'TestConfiguration'
+ constraint MinimalTestConfiguration {
+ check: self.connection->exists(c |
+ (c.endPoint->at(0).component.role.name = 'Tester'
+ and c.endPoint->at(1).component.role.name = 'SUT')
+ or (c.endPoint->at(0).component.role.name = 'SUT'
+ and c.endPoint->at(1).component.role.name = 'Tester'))
+ message: self.prefix()+"Each 'TestConfiguration' shall specify at least one 'Connection' that connects a 'GateInstance' of a 'ComponentInstance' in the role 'Tester' with a 'GateInstance' of a 'ComponentInstance' in the role 'SUT'."
+ }
+//At most one connection between any two 'GateInstance'/'ComponentInstance' pairs
+ constraint UniqueConnections {
+ check: self.connection->forAll(c1 | self.connection->one(c2 |
+ (c1.endPoint->at(0).component = c2.endPoint->at(0).component
+ and c1.endPoint->at(0).gate = c2.endPoint->at(0).gate
+ and c1.endPoint->at(1).component = c2.endPoint->at(1).component
+ and c1.endPoint->at(1).gate = c2.endPoint->at(1).gate)
+
+ or (c1.endPoint->at(1).component = c2.endPoint->at(0).component
+ and c1.endPoint->at(1).gate = c2.endPoint->at(0).gate
+ and c1.endPoint->at(0).component = c2.endPoint->at(1).component
+ and c1.endPoint->at(0).gate = c2.endPoint->at(1).gate
+ )))
+ message: self.prefix()+"Given the set of 'Connection's contained in a 'TestConfiguration'. There shall be no two 'Connection's containing 'GateReference's that in turn refer to identical pairs of 'GateInstance'/'ComponentInstance'."
+ }
+
+}
+
+context Block {
+//Constraints
+//Guard shall evaluate to Boolean
+ constraint GuardType {
+ check: self.`guard`->forAll(g | g.expression.oclIsUndefined()
+ or g.expression.getDataType().name = 'Boolean')
+ message: self.prefix()+"The type of 'guard' shall be 'Boolean'."
+ }
+}
+
+context BoundedLoopBehaviour {
+//Constraints
+//No guard constraint
+ constraint BoundedGuard {
+ check: not self.block.`guard`.oclIsUndefined()
+ message: self.prefix()+"The 'Block' of a 'BoundedLoopBehaviour' shall not have a 'guard'."
+ }
+//cannot be expressed, may need to be removed
+//Iteration number shall be countable and positive
+// The expression assigned to the 'numIteration' property shall evaluate to a countable 'SimpleDataInstance' of an arbitrary user-defined data type, e.g. a positive Integer value.
+
+}
+
+
+context AlternativeBehaviour {
+//Constraints
+//Number of 'Block's
+ constraint AlternativeBlockCount {
+ check: self.block->size() > 1
+ message: self.prefix()+"An 'AlternativeBehaviour' shall contain at least two 'Block's."
+ }
+//First behaviour of 'Block's
+ constraint FirstBlockBehaviour {
+ //TODO: update the description of tester input event
+ //tester input event:
+ // - Interaction with target.gate.component.role.name = 'Tester'
+ // - TimerTimeout
+ // - Quiescence
+ //TODO: update with clarification
+ // - not transitive - the first behaviour has to be one of the
+ // tester input events, directly within the block of the alternative
+ // nesting is excluded
+ //TODO: update with clarification
+ // - tester input event interaction shall orginiate at the SUT
+ check: self.block->forAll(b | b.behaviour->first().isTesterInputEvent())
+ message: self.prefix()+"Each block of an 'AlternativeBehaviour' shall start with a tester-input event."
+ }
+
+}
+
+context ConditionalBehaviour {
+//Constraints
+//Guard for 'ConditionalBehaviour' with single block
+ constraint ConditionalFirstGuard {
+ check: self.block->size() > 1
+ or not self.block->first().`guard`.oclIsUndefined()
+ message: self.prefix()+"If there is only one 'Block' specified, it shall have a 'guard'."
+ }
+//Possible else block for 'ConditionalBehaviour' with multiple blocks
+ constraint ConditionalLastGuard {
+ check: self.block->size() = 1
+ or self.block->forAll(b |
+ b = self.block->last()
+ or not b.`guard`.oclIsUndefined())
+ message: self.prefix()+"All 'Block's specified, except the last one, shall have a 'guard'."
+ }
+
+//removed
+//First 'AtomicBehaviour' allowed
+/*
+ constraint ConditionalFirstBehaviour {
+ check: self.block->forAll(b | not b.behaviour.first().isTesterInputEvent())
+ message: self.prefix()+"The first 'AtomicBehaviour' of any 'Block' of a 'ConditionalBehaviour' shall not be a tester-input event."
+ }
+*/
+}
+
+
+context ParallelBehaviour {
+//Constraints
+//Number of blocks in 'ParallelBehaviour'
+ constraint ParallelBlockCount {
+ check: self.block->size() > 1
+ message: self.prefix()+"There shall be at least two 'Block's specified."
+ }
+}
+
+context ExceptionalBehaviour {
+//Constraints
+//No guard
+//removed
+// constraint ExceptionalGuard {
+// check: self.block.`guard`.oclIsUndefined()
+// message: "The 'Block' shall have no guard."
+// }
+
+//First 'AtomicBehaviour' in block allowed
+// Each block of an 'ExceptionalBehaviour' shall start with a tester-input event.
+ constraint FirstExceptionalBehaviour {
+ check: self.block.behaviour->first().isTesterInputEvent()
+ message: self.prefix()+"The block of an 'ExceptionalBehaviour' shall start with a tester-input event."
+ }
+
+//Guarded component shall be a 'Tester' component
+ constraint ExceptionalGuardedComponent {
+ check: self.guardedComponent.oclIsUndefined()
+ or self.guardedComponent.role.name = 'Tester'
+ message: self.prefix()+"The 'guardedComponent' shall refer to a 'ComponentInstance' with the role of 'Tester'."
+ }
+
+}
+
+context PeriodicBehaviour {
+//Constraints
+//Removed
+//First 'AtomicBehaviour' allowed
+// The first 'AtomicBehaviour' of any 'Block' of a 'PeriodicBehaviour' shall not be a tester-input event.
+//'Time' data type for period expression
+ constraint PeriodType {
+ check: self.period->forAll(p | p.expression.getDataType().oclIsKindOf(Time))
+ message: self.prefix()+"The 'DataUse' expression assigned to the 'period' shall evaluate to a data instance of the 'Time' data type."
+ }
+
+}
+
+context VerdictAssignment {
+//Constraints
+//Verdict of type 'Verdict'
+ constraint VerdictType {
+ check: self.verdict.getDataType().name = 'Verdict'
+ message: self.prefix()+"The 'verdict' shall evaluate to a, possibly predefined, instance of a 'SimpleDataInstance' of data type 'Verdict'."
+ }
+
+}
+
+context Assertion {
+//Constraints
+//Boolean condition
+ constraint AssertionOtherwise {
+ check: self.condition.getDataType().name = 'Boolean'
+ message: self.prefix()+"The 'condition' shall evaluate to predefined 'DataType' 'Boolean'."
+ }
+//Otherwise of type 'Verdict'
+ constraint AssertionVerdict {
+ check: self.otherwise.oclIsUndefined() or self.otherwise.getDataType().name = 'Verdict'
+ message: self.prefix()+"The 'otherwise' shall evaluate to a, possibly predefined, instance of a 'SimpleDataInstance' of data type 'Verdict'."
+ }
+
+}
+
+context Interaction {
+//Constraints
+//Gate references of an interaction shall be different
+// constraint DistinctInteractionGates {
+// //removed - already covered under connection and connected gates
+// check: not self.target->exists(t | t.targetGate = self.sourceGate)
+// message: self.prefix()+"All 'GateReference's that act as source or target(s) of an 'Interaction' shall be different from each other."
+// }
+//Gate references of an interaction shall be connected
+ constraint ConnectedInteractionGates {
+ check: self.target.forAll(t |
+ self.getTestDescription().testConfiguration.connection->exists(c |
+ (c.endPoint->at(0).gate = self.sourceGate.gate
+ and c.endPoint->at(0).component = self.sourceGate.component
+ and c.endPoint->at(1).gate = t.targetGate.gate
+ and c.endPoint->at(1).component = t.targetGate.component)
+
+ or (c.endPoint->at(1).gate = self.sourceGate.gate
+ and c.endPoint->at(1).component = self.sourceGate.component
+ and c.endPoint->at(0).gate = t.targetGate.gate
+ and c.endPoint->at(0).component = t.targetGate.component)))
+ message: self.prefix()+"The 'GateReference's that act as source or target(s) of an 'Interaction' shall be interconnected by a 'Connection'."
+ }
+//Type of interaction argument
+ constraint InteractionArgumentAndGateType {
+ check: (self.argument.oclIsKindOf(AnyValue) and self.argument.dataType.oclIsUndefined())
+ or (self.sourceGate.gate.type.dataType->includes(self.argument.getDataType())
+ and self.target.forAll(t | t.targetGate.gate.type.dataType->includes(self.argument.getDataType())))
+ message: self.prefix()+"The 'DataUse' specification referred to in the 'argument' shall match one of the 'DataType's referenced in the 'GateType' definition of the 'GateInstance's referred to by the source and target 'GateReference's of the 'Interaction'."
+ }
+//Use of variables in the 'argument' specification
+ constraint InteractionArgumentVariableUse {
+ check: (not self.argument.oclIsKindOf(VariableUse)
+ or (self.sourceGate.component = self.argument.componentInstance
+ or self.target->forAll(t |
+ t.targetGate.component = self.argument.componentInstance)))
+
+ and self.argument.argument->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.sourceGate.component = a.dataUse.componentInstance
+ or self.target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+
+ and self.argument.argument->closure(a | a.dataUse.argument)->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.sourceGate.component = a.dataUse.componentInstance
+ or self.target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+
+ message: self.prefix()+"The use of 'Variable's in the 'DataUse' specification shall be restricted to 'Variable's of 'ComponentInstance's that participate in this 'Interaction' via the provided 'GateReference's."
+ }
+
+//Matching data type for 'argument' and 'variable'
+ constraint InteractionArgumentAndVariableType {
+ check: self.target.forAll(t |
+ t.variable.oclIsUndefined()
+ or t.variable.dataType = self.argument.getDataType())
+ message: self.prefix()+"The 'DataUse' specification of the 'argument' and the referenced 'Variable' of any 'Target' shall refer to the same 'DataType'."
+ }
+
+//'DataType' for 'AnyValue' as 'argument'
+// constraint AnyValueDataType {
+// check: self.argument.oclIsKindOf(AnyValue)
+// and (self.argument.argument.isEmpty() or not self.argument.dataType.oclIsUndefined())
+// message: self.prefix()+"If 'AnyValue' is used as 'argument' and of the 'Interaction' and the optional 'ParameterBinding's are provided, the 'dataType' of 'AnyValue' shall be specified."
+// }
+
+}
+
+context Target {
+//Constraints
+//Variable and target gate of the same component instance
+ constraint TargetComponent {
+ check: self.variable.oclIsUndefined()
+ or self.targetGate.component.type.variable->contains(self.variable)
+ message: self.prefix()+"The referenced 'Variable' shall exist in the same 'ComponentType' as the 'GateInstance' that is referred to by the 'GateReference' of the 'targetGate'."
+ }
+//Variable of a tester component only
+ constraint TargetVariableComponentRole {
+ check: self.variable.oclIsUndefined()
+ or self.targetGate.component.role.name = 'Tester'
+ message: self.prefix()+"If a 'Variable' is specified, the 'ComponentInstance' referenced by 'targetGate' shall be in the role 'Tester'."
+ }
+
+}
+
+context TestDescriptionReference {
+//Constraints
+//Number of actual parameters
+ constraint ParameterCount {
+ check: self.actualParameter->size() = self.testDescription.formalParameter->size()
+ message: self.prefix()+"The number of actual parameters in the 'TestDescriptionReference' shall be equal to the number of formal parameters of the referenced 'TestDescription'."
+ }
+
+//No use of variables in actual parameters
+ constraint NoVariables {
+ check: self.actualParameter.forAll(p |
+ not p.oclIsKindOf(VariableUse)
+ and p.argument->forAll(a | not a.dataUse.oclIsKindOf(VariableUse))
+ and p.argument->closure(a | a.dataUse.argument)->forAll(a | not a.dataUse.oclIsKindOf(VariableUse)))
+
+ message: self.prefix()+"The 'DataUse' expressions used to describe actual parameters shall not contain variables directly or indirectly."
+ }
+
+//Matching parameters
+ constraint TestDescriptionParameters {
+ check: self.actualParameter.forAll(ap |
+ self.testDescription.formalParameter->size() > self.actualParameter->indexOf(ap)
+ and ap.getDataType() = self.testDescription.formalParameter->at(self.actualParameter.indexOf(ap)).dataType)
+ message: self.prefix()+"The actual parameter AP[i] of index i in the ordered list of 'actualParameter's shall match 'DataType' of the 'FormalParameter' FP[i] of index i in the ordered list of formal parameters of the referenced 'TestDescription'."
+ }
+
+//Restriction to 1:1 component instance bindings
+ constraint UniqueComponentBindings {
+ check: self.componentInstanceBinding->isEmpty()
+ or self.componentInstanceBinding->forAll(b | self.componentInstanceBinding->one(c | c.formalComponent = b.formalComponent or c.actualComponent = b.actualComponent))
+ message: self.prefix()+"If component instance bindings are provided, the component instances referred to in the bindings shall occur at most once for the given test description reference."
+ }
+
+//redundat: add containment constraint similar to the one for gates, see ComponentInstanceBinding below
+// - bound compoent instances need to be contained in the test configurations used by
+// the corresponding test descriptions, with disntictions for formal and actual components
+
+/*Compatible test configurations
+ The test configuration TConf2 of the referenced (invoked) test description shall be compatible with the test configuration TConf1 of the referencing (invoking) test description under the provision of a list of bindings between component instances in TConf1 and TConf2. Compatibility is then defined in the following terms:
+ All component instances in TConf2 can be mapped to component instances of TConf1.A component instance B of test configuration TConf2 can be mapped to a component instance A of test configuration TConf1if and only if:
+ a) there is a binding pair (A, B) provided;
+ b) A and B refer to the same component type; and
+ c) A and B have the same component instance role {SUT, Tester} assigned.
+ All connections between component instances in TConf2 exist also between the mapped component instances in TConf1 and the type of a connection in TConf2 equals the type of the related connection in TConf1.Two connections of the two test configurations are equal if and only if the same gate instances are used in the definition of the gate references of the connections.
+ NOTE 1: The compatibility between test configurations is defined asymmetrically. That is, if TConf2 is compatible with TConf1, it does not imply that TConf1is compatible with TConf2. If TConf2 is compatible with TConf1, it is said that TConf2 is a sub-configuration of TConf1 under a given binding.
+ NOTE 2: If two test configurations are equal, then they are also compatible.
+*/
+ constraint CompatibleConfiguration {
+ //same configuration with no bindings
+ check: (self.getTestDescription().testConfiguration = self.testDescription.testConfiguration
+ and self.componentInstanceBinding->isEmpty())
+ //component bindings for all components exist
+ or (self.testDescription.testConfiguration.connection->forAll(c |
+ self.componentInstanceBinding->exists(i |
+ i.formalComponent = c.endPoint->at(0).component)
+ and self.componentInstanceBinding->exists(i |
+ i.formalComponent = c.endPoint->at(1).component)
+ //provided -> select matched -> check matched
+ and self.getTestDescription().testConfiguration.connection->select(p |
+ (p.endPoint->at(0).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint->at(0).component)->first().actualComponent
+ and p.endPoint->at(1).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint->at(1).component)->first().actualComponent)
+ or (p.endPoint->at(1).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint->at(0).component)->first().actualComponent
+ and p.endPoint->at(0).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint->at(1).component)->first().actualComponent))->exists(m |
+ (m.endPoint->at(0).gate.type = c.endPoint->at(0).gate.type
+ and m.endPoint->at(1).gate.type = c.endPoint->at(1).gate.type)
+ or (m.endPoint->at(0).gate.type = c.endPoint->at(1).gate.type
+ and m.endPoint->at(1).gate.type = c.endPoint->at(0).gate.type))))
+ message: self.prefix()+"The test configuration TConf2 of the referenced (invoked) test description shall be compatible with the test configuration TConf1 of the referencing (invoking) test description."
+ }
+}
+
+context ComponentInstanceBinding {
+//Constraints
+//remove - redundant
+//'ComponentInstance's from from referenced 'TestConfiguration's
+// constraint ComponentInstanceContainment {
+// check: self.container().testDescription.testConfiguration.componentInstance->contains(self.formalComponent)
+// and self.getTestDescription().testConfiguration.componentInstance->contains(self.actualComponent)
+// message: self.prefix()+"All formal 'ComponentInstance's shall be contained in the 'TestConfiguration' of the invoked 'TestDescription' and all actual 'ComponentInstance's shall be contained in the 'TestConfiguration' of the invoking 'TestDescription'."
+// }
+
+//Matching component types
+ constraint BindingComponentTypes {
+ check: self.formalComponent.type = self.actualComponent.type
+ message: self.prefix()+"Both, the formal and the actual component instances, shall refer to the same 'ComponentType'."
+ }
+//Matching component instance roles
+ constraint BindingComponentRoles {
+ check: self.formalComponent.role = self.actualComponent.role
+ message: self.prefix()+"Both, the formal and the actual component instances, shall have the same 'ComponentInstanceRole' assigned to."
+ }
+}
+
+
+
+context ActionBehaviour {
+//Constraints
+//'ActionBehaviour' on 'Tester' components only
+ constraint ActionBehaviourComponentRole {
+ check: self.componentInstance.oclIsUndefined()
+ or self.componentInstance.role.name = 'Tester'
+ message: self.prefix()+"The 'ComponentInstance' that an 'ActionBehaviour' refers to shall be of role 'Tester'."
+ }
+
+}
+
+context ActionReference {
+//Constraints
+//Matching parameters
+ constraint ActionParameters {
+ check: self.actualParameter->forAll(ap |
+ ap.getDataType() = self.action.formalParameter->at(self.actualParameter->indexOf(ap)).dataType)
+ message: self.prefix()+"The actual parameter AP[i] of index i in the ordered set of 'actualParameter's shall match the 'DataType' of the 'FormalParameter' FP[i] of index i in the ordered set of formal parameters of the referenced 'Action'."
+ }
+
+}
+
+context Assignment {
+//Constraints
+//Known component instance
+ constraint AssignmentComponent {
+ //TODO: update syntax? current syntax flexibility allows validation!
+ check: not self.componentInstance.oclIsUndefined()
+ message: self.prefix()+"The property 'componentInstance' shall be set to identify the 'Variable' in this 'Assignment'."
+ }
+//Matching data type
+ constraint AssignmentDataType {
+ check: self.expression.getDataType() = self.variable.dataType
+ message: self.prefix()+"The provided 'DataUse' expression shall match the 'DataType' of the referenced 'Variable'."
+ }
+}
+
+//added a constraint that connections can only be established - see above
+// between gates of components from the same test configuration
+// possibly also regarding components owning the connected gates
+// - the latter already covered by the constraint under GateReference
+
+
+
+
+
+
+
+
+context Assignment {
+//Constraints
+//Known component instance
+ constraint AssignmentComponent {
+ //TODO: update syntax? current syntax flexibility allows validation!
+ check: not self.componentInstance.oclIsUndefined()
+ message: self.prefix()+"The property 'componentInstance' shall be set to identify the 'Variable' in this 'Assignment'."
+ }
+//Matching data type
+ constraint AssignmentDataType {
+ check: self.expression.getDataType() = self.variable.dataType
+ message: self.prefix()+"The provided 'DataUse' expression shall match the 'DataType' of the referenced 'Variable'."
+ }
+}
diff --git a/plugins/org.etsi.mts.tdl.constraints/epsilon/constraints/to.evl b/plugins/org.etsi.mts.tdl.constraints/epsilon/constraints/to.evl
new file mode 100644
index 0000000000000000000000000000000000000000..fd6fb1c83bd0b3bb75f63962adf94d44f764251b
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/epsilon/constraints/to.evl
@@ -0,0 +1,127 @@
+import "../library/common.eol";
+import "../library/helper.eol";
+import "../library/debug.eol";
+
+//Combining Multiple 'PICSReference's
+//A 'Comment' with body containing an 'and' or 'or' shall be attached to the 'PICSReference' as a Boolean operand if there are two or more 'PICSReference's and it is not the first 'PICSReference'.
+context PICSReference {
+constraint MultiplePICS {
+ check:
+ self.container().picsReference->size() < 2
+ or self.container().picsReference->forAll(p |
+ self.container().picsReference->at(0) = p
+ or (not p.comment->isEmpty()
+ and (p.comment->first().body = 'and'
+ or p.comment->first().body = 'or')))
+ message:
+ "A 'Comment' with body containing an 'and' or 'or' shall be attached to the 'PICSReference' as a Boolean operand if there are two or more 'PICSReference's and it is not the first 'PICSReference'."
+}
+}
+
+//Either ‘repetition’, or ‘interval’ or neither shall be specified
+//At most one of the optional properties ‘repetition’ or ‘interval’ shall be defined.
+context RepeatedEventSequence {
+constraint RepetitionOrInterval {
+ check:
+ self.repetitions.oclIsUndefined() or self.interval.oclIsUndefined()
+ message:
+ "At most one of the optional properties ‘repetition’ or ‘interval’ shall be defined."
+}
+}
+
+//Combining Multiple 'EventOccurrence's
+//A 'Comment' with body containing an 'and' or 'or' shall be attached to the 'EventOccurrence' as an operand if there are two or more 'EventOccurrence's and it is not the first 'EventOccurrence'.
+context EventOccurrence {
+constraint MultipleEventOccurrences{
+ check:
+ self.container().oclIsTypeOf(EventSpecificationTemplate)
+ or self.container().events->size() < 2
+ or self.container().events->forAll(o |
+ self.container().events->at(0) = o
+ or (not o.comment->isEmpty()
+ and (o.comment->first().body = 'and'
+ or o.comment->first().body = 'or')))
+ message:
+ "A 'Comment' with body containing an 'and' or 'or' shall be attached to the 'EventOccurrence' as an operand if there are two or more 'EventOccurrence's and it is not the first 'EventOccurrence'."
+}
+}
+
+
+//An 'Entity' or a 'ComponentInstance' shall be referenced.
+//There shall be a reference to an 'Entity' or a 'ComponentInstance' but not both.
+context EntityReference {
+constraint EntityOrComponentInstance {
+ check:
+ (not self.entity.oclIsUndefined() and self.component.oclIsUndefined())
+ or (self.entity.oclIsUndefined() and not self.component.oclIsUndefined())
+ message:
+ "There shall be a reference to an 'Entity' or a 'ComponentInstance' but not both."
+}
+}
+
+//No nested 'Content's if 'Value' is provided
+//Either nested 'Content's or 'Value' may be specified within 'Content', but not both.
+context Content {
+constraint ContentOrValue {
+ check:
+ self.content->isEmpty() or self.value.oclIsUndefined()
+ message:
+ "Either nested 'Content's or 'Value' may be specified within 'Content', but not both."
+}
+}
+
+
+//Referenced 'LiteralValue' visibility
+//Only 'LiteralValue's defined within previous 'EventOccurrence's of the containing 'StructuredTestObjective' may be referenced.
+context LiteralValueReference {
+constraint VisibleValue {
+ check:
+ self.getTestObjective().contains(self.content)
+and self.getTestObjective().indexOf(self.content) < self.getTestObjective().indexOf(self)
+ message:
+ "Only 'LiteralValue's defined within previous 'EventOccurrence's of the containing 'StructuredTestObjective' may be referenced."
+}
+}
+
+//Referenced 'Content' visibility
+//Only 'Content's defined within previous 'EventOccurrence's of the containing 'StructuredTestObjective' may be referenced.
+context ContentReference {
+constraint VisibleContent {
+ check:
+ self.getTestObjective().contains(self.content)
+and self.getTestObjective().indexOf(self.content) < self.getTestObjective().indexOf(self)
+ message:
+ "Only 'Content's defined within previous 'EventOccurrence's of the containing 'StructuredTestObjective' may be referenced."
+}
+}
+
+
+//'DataInstanceUse' restrictions within 'DataReference'
+//Only simple and structured data instances may be referenced directly or indirectly in 'ParameterBinding's of the 'StaticDataUse' within a 'DataReference'.
+context DataReference {
+constraint DataReferenceContents {
+ check:
+ self.content.oclIsKindOf(StaticDataUse)
+and self.content.argument->forAll(a | a.dataUse.oclIsKindOf(StaticDataUse))
+and self.content.argument->closure(a | a.dataUse.argument)->forAll(a|a.dataUse.oclIsKindOf(StaticDataUse))
+ message:
+ "Only simple and structured data instances may be referenced directly or indirectly in 'ParameterBinding's of the 'StaticDataUse' within a 'DataReference'."
+}
+}
+
+//‘EntityReference’ of referenced ‘EventSpecificationTemplate’
+//If ‘EntityBinding’s are provided, he ‘Entity’s referenced in the ‘templateEntity’ properties shall also be referenced by one of the ‘EntityReferences’ in the ‘EventOccurrenceSpecification’ of the 'EventSpecificationTemplate' referenced in the ‘EventTemplateOccurrence’.
+context EventTemplateOccurrence {
+constraint EntityTemplateOccurrenceConsistency {
+ check:
+ self.entityBinding->forAll(b |
+ (not b.templateEntity.entity.oclIsUndefined() and (b.templateEntity.entity = self.eventTemplate.eventSpecification.entityReference.entity))
+ or (not b.templateEntity.component.oclIsUndefined() and (b.templateEntity.component = self.eventTemplate.eventSpecification.entityReference.component)
+ or self.eventTemplate.eventSpecification.oppositeEntityReference->exists(e |
+ (not b.templateEntity.entity.oclIsUndefined() and (e.entity = b.templateEntity.entity))
+ or (not b.templateEntity.component.oclIsUndefined() and (e.component = b.templateEntity.component)))))
+
+ message:
+ "If ‘EntityBinding’s are provided, he ‘Entity’s referenced in the ‘templateEntity’ properties shall also be referenced by one of the ‘EntityReferences’ in the ‘EventOccurrenceSpecification’ of the 'EventSpecificationTemplate' referenced in the ‘EventTemplateOccurrence’."
+}
+}
diff --git a/plugins/org.etsi.mts.tdl.constraints/epsilon/library/common.eol b/plugins/org.etsi.mts.tdl.constraints/epsilon/library/common.eol
new file mode 100644
index 0000000000000000000000000000000000000000..a406069253d8b7ac908560b7f5877f868e2975d2
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/epsilon/library/common.eol
@@ -0,0 +1,144 @@
+//Supporting operation aliases for OCL
+operation Any oclIsUndefined() : Boolean {
+ return self.isUndefined();
+}
+
+operation Any oclIsTypeOf(t:Any) : Boolean {
+ return self.isTypeOf(t);
+}
+
+operation Any oclIsKindOf(t:Any) : Boolean {
+ return self.isKindOf(t);
+}
+
+
+operation Any oclAsType(t:Any) : Any {
+ return self;
+}
+
+operation Any notEmpty() : Boolean {
+ return not self.isEmpty();
+}
+
+
+operation Any container() : Any {
+ return self.eContainer;
+}
+
+operation String size() : Integer {
+ return self.length();
+}
+
+
+//Supporting operations
+operation Any getTestDescription() : Any {
+ if (self.eContainer.isDefined()) {
+ if (not self.eContainer.isKindOf(TestDescription)) {
+ return self.eContainer.getTestDescription();
+ } else {
+ return self.eContainer;
+ }
+ }
+}
+
+operation Any getTestObjective() : Any {
+ if (self.eContainer.isDefined()) {
+ if (not self.eContainer.isKindOf(StructuredTestObjective)) {
+ return self.eContainer.getTestObjective();
+ } else {
+ return self.eContainer;
+ }
+ }
+}
+
+operation Any contains(object : Any) : Boolean {
+ return self.eAllContents().includes(object);
+}
+
+operation TDL!StructuredTestObjective indexOf(object : Any) : Integer {
+ return self.eAllContents().indexOf(object);
+}
+
+
+//QualifiedNames
+operation Any qualifiedName() : String {
+ var p = self.getNamedParent();
+ if (p.isDefined()) {
+ var suffix = "";
+ if (self.name.isDefined()) {
+ suffix = "::"+self.name;
+ }
+ return p.qualifiedName()+suffix;
+ } else {
+ return self.name;
+ }
+}
+
+operation Any getNamedParent() : Any {
+ if (self.eContainer.isDefined()) {
+ if (not self.eContainer.isKindOf(NamedElement)) {
+ return self.eContainer.getNamedParent();
+ } else {
+ return self.eContainer;
+ }
+ }
+}
+
+
+//Get Data Type
+//TODO: add support for reduction..
+//TODO: check for reduction too once support is added
+operation TDL!DataInstanceUse getDataType() : Any {
+ if (not self.dataInstance.oclIsUndefined()) {
+ return self.dataInstance.dataType;
+ } else if (not self.dataType.oclIsUndefined()) {
+ return self.dataType;
+ } else {
+ if (self.container().oclIsTypeOf(MemberAssignment)) {
+ return self.container().member.dataType;
+ } else if (self.container().oclIsTypeOf(ParameterBinding)) {
+ return self.container().parameter.dataType;
+ } else {
+ (self.container().type.name+".getDataType() not yet defined").println();
+ }
+ }
+}
+
+operation TDL!FunctionCall getDataType() : Any {
+ return self.`function`.returnType;
+}
+
+operation TDL!VariableUse getDataType() : Any {
+ return self.variable.dataType;
+}
+
+operation TDL!TimeLabelUse getDataType() : Any {
+ return Time.allInstances().first();
+}
+
+operation TDL!FormalParameterUse getDataType() : Any {
+ return self.parameter.dataType;
+}
+
+operation TDL!SpecialValueUse getDataType() : Any {
+ var t;
+ if (self.eContainer.isTypeOf(MemberAssignment)) {
+ t = self.eContainer.member.dataType;
+ } else if (self.eContainer.isTypeOf(ParameterBinding)) {
+ t = self.eContainer.parameter.dataType;
+ } else if (self.eContainer.isTypeOf(Interaction) and
+ self.isTypeOf(AnyValue)) {
+ t = self.dataType;
+ }
+ return t;
+}
+
+//Check if Behaviour is tester input event
+operation TDL!Behaviour isTesterInputEvent() : Boolean {
+ return self.oclIsKindOf(TimeOut)
+ or self.oclIsKindOf(Quiescence)
+ or (self.oclIsKindOf(Interaction)
+ and self.sourceGate.component.role.name = 'SUT'
+ and self.target->exists(t | t.targetGate.component.role.name = 'Tester'));
+}
+
diff --git a/plugins/org.etsi.mts.tdl.constraints/epsilon/library/debug.eol b/plugins/org.etsi.mts.tdl.constraints/epsilon/library/debug.eol
new file mode 100644
index 0000000000000000000000000000000000000000..7d708f94f7d69096493572ba6ff3985930a2e797
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/epsilon/library/debug.eol
@@ -0,0 +1,366 @@
+//Debugging operations
+operation Any prefix() : String {
+ return self.type().name+": "+self.qualifiedName() + " ";
+}
+
+operation Any debugAnnotations() : Boolean {
+ self.println();
+ (" Annotations: "+self.annotation).println();
+ (" Comments: "+self.comment).println();
+ return true;
+}
+
+operation Any debugTimeConstraintVariables() : Boolean {
+ var expressionConstraint =
+ (not self.timeConstraintExpression.oclIsKindOf(VariableUse)
+ or (self.oclContainer().oclIsKindOf(Interaction)
+ and (self.oclContainer().sourceGate.component = self.timeConstraintExpression.componentInstance
+ or self.oclContainer().target->forAll(t |
+ t.targetGate.component = self.timeConstraintExpression.componentInstance)))
+ or (self.oclContainer().oclIsKindOf(ActionBehaviour)
+ and not self.oclContainer().componentInstance.oclIsUndefined()
+ and self.oclContainer().componentInstance = self.timeConstraintExpression.componentInstance));
+
+
+ var argumentConstraint =
+ self.timeConstraintExpression.argument->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.oclContainer().oclIsKindOf(Interaction)
+ and (self.oclContainer().sourceGate.component = a.dataUse.componentInstance
+ or self.oclContainer().target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+ or (self.oclContainer().oclIsKindOf(ActionBehaviour)
+ and not self.oclContainer().componentInstance.oclIsUndefined()
+ and self.oclContainer().componentInstance = self.timeConstraintExpression.componentInstance));
+
+ var nestedArgumentConstraint =
+ self.timeConstraintExpression.argument->closure(a | a.dataUse.argument)->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.oclContainer().oclIsKindOf(Interaction)
+ and (self.oclContainer().sourceGate.component = a.dataUse.componentInstance
+ or self.oclContainer().target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+ or (self.oclContainer().oclIsKindOf(ActionBehaviour)
+ and not self.oclContainer().componentInstance.oclIsUndefined()
+ and self.oclContainer().componentInstance = self.timeConstraintExpression.componentInstance));
+
+ ("TC: EC: " + expressionConstraint).println();
+ ("TC: AC: " + argumentConstraint).println();
+ ("TC: NC: " + nestedArgumentConstraint).println();
+ for (a in self.timeConstraintExpression.argument) {
+ if (a.dataUse.oclIsKindOf(VariableUse)) {
+ if (self.oclContainer().oclIsKindOf(Interaction)) {
+ if (self.oclContainer().sourceGate.component = a.dataUse.componentInstance) {
+ ("TC: Argument -> Variable -> Interaction -> Source").println();
+ } else if (self.oclContainer().target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)) {
+ ("TC: Argument -> Variable -> Interaction -> Targets").println();
+ } else {
+ ("TC: Argument -> Variable -> Interaction -> None -> FAIL!").println();
+ }
+ }
+ }
+ }
+
+
+
+ var constraint =
+ (not self.timeConstraintExpression.oclIsKindOf(VariableUse)
+ or (self.oclContainer().oclIsKindOf(Interaction)
+ and (self.oclContainer().sourceGate.component = self.timeConstraintExpression.componentInstance
+ or self.oclContainer().target->forAll(t |
+ t.targetGate.component = self.timeConstraintExpression.componentInstance)))
+ or (self.oclContainer().oclIsKindOf(ActionBehaviour)
+ and not self.oclContainer().componentInstance.oclIsUndefined()
+ and self.oclContainer().componentInstance = self.timeConstraintExpression.componentInstance))
+
+ and self.timeConstraintExpression.argument->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.oclContainer().oclIsKindOf(Interaction)
+ and (self.oclContainer().sourceGate.component = a.dataUse.componentInstance
+ or self.oclContainer().target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+ or (self.oclContainer().oclIsKindOf(ActionBehaviour)
+ and not self.oclContainer().componentInstance.oclIsUndefined()
+ and self.oclContainer().componentInstance = self.timeConstraintExpression.componentInstance))
+
+ and self.timeConstraintExpression.argument->closure(a | a.dataUse.argument)->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.oclContainer().oclIsKindOf(Interaction)
+ and (self.oclContainer().sourceGate.component = a.dataUse.componentInstance
+ or self.oclContainer().target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+ or (self.oclContainer().oclIsKindOf(ActionBehaviour)
+ and not self.oclContainer().componentInstance.oclIsUndefined()
+ and self.oclContainer().componentInstance = self.timeConstraintExpression.componentInstance))
+ ;
+ return constraint;
+}
+
+
+
+operation Any debugInteractionVariableUse() : Boolean {
+ var constraint =
+ (not self.argument.oclIsKindOf(VariableUse)
+ or (self.sourceGate.component = self.argument.componentInstance
+ or self.target->forAll(t |
+ t.targetGate.component = self.argument.componentInstance)))
+
+ and self.argument.argument->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.sourceGate.component = a.dataUse.componentInstance
+ or self.target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+
+ and self.argument.argument->closure(a | a.dataUse.argument)->forAll(a |
+ not a.dataUse.oclIsKindOf(VariableUse)
+ or (self.sourceGate.component = a.dataUse.componentInstance
+ or self.target->forAll(t |
+ t.targetGate.component = a.dataUse.componentInstance)))
+ ;
+
+ return constraint;
+}
+
+operation Any debugInteractionVariable() : Boolean {
+ for (t in self.target) {
+ if (t.variable.isDefined()) {
+ t.variable.dataType.qualifiedName().println();
+ }
+ }
+ return true;
+}
+
+operation Any debugInteractionGates() : Boolean {
+ var connected = self.target.forAll(t |
+ self.getTestDescription().testConfiguration.connection->exists(c |
+ (c.endPoint->at(0).gate = self.sourceGate.gate
+ and c.endPoint->at(0).component = self.sourceGate.component
+ and c.endPoint->at(1).gate = t.targetGate.gate
+ and c.endPoint->at(1).component = t.targetGate.component)
+
+ or (c.endPoint->at(1).gate = self.sourceGate.gate
+ and c.endPoint->at(1).component = self.sourceGate.component
+ and c.endPoint->at(0).gate = t.targetGate.gate
+ and c.endPoint->at(0).component = t.targetGate.component)));
+
+ for (t in self.target) {
+ (" Looking for:" +self.sourceGate.qualifiedName() + " <---> " + t.targetGate.qualifiedName()+"...").println();
+
+ for (c in (self.getTestDescription().testConfiguration.connection->select(c |
+ (c.endPoint->at(0) = self.sourceGate and c.endPoint->at(1) = t.targetGate)
+ or (c.endPoint->at(1) = self.sourceGate and c.endPoint->at(0) = t.targetGate)))) {
+ (" "+c.qualifiedName()).println();
+ }
+ }
+ (" ->"+connected).println();
+ return true;
+}
+
+
+operation Any debugCyclicImports() : Boolean {
+ for (x in self.`import`->asOrderedSet()->closure(i|i.importedPackage.`import`)) {
+ if (x.importedPackage = self) {
+ (self.qualifiedName()+" :: "+x+" : " +x.importedPackage.qualifiedName()).println();
+ }
+ }
+ //return self.`import`->asOrderedSet()->closure(i|i.importedPackage.`import`)->forAll(i | i.importedPackage <> self);
+ return true;
+}
+
+operation Any debugMemberSpec() : Boolean {
+ " EE".println();
+ (" "+self.eContainer.name + ":: " +self.member.eContainer.name+" : "+self.member.name).print();
+ (" ->"+(self.memberSpec.argument->forAll(a|a.dataUse.oclIsKindOf(StaticDataUse)) and
+ self.memberSpec.argument->closure(a|a.dataUse.argument)->forAll(a|a.dataUse.oclIsKindOf(StaticDataUse)))).println();
+ for (x in self.memberSpec.argument) {
+ (" A::::>"+x.parameter.name+" => "+x.dataUse).println();
+ }
+
+ for (x in self.memberSpec.argument->closure(a|a.dataUse.argument)) {
+ (" C::::>"+x.parameter.name+" =>"+x.dataUse).println();
+ }
+ return true;
+}
+
+operation Any debugQualifiedNames() : Boolean {
+ (":::::: QN :::::: " + self.qualifiedName()).println();
+ return true;
+}
+
+operation Any debugReductionMembers() : Boolean {
+ (self.getNamedParent().qualifiedName() + " ->> " +self.targetElement()).println();
+ //self.targetElement().qualifiedName().println();
+ for (m in self.reduction) {
+ (" "+self.reduction->indexOf(m) + " : " +self.qualifiedName()+m.name).print();
+ (" : ").print();
+ if (self.reduction->indexOf(m) = 0) {
+ (self.getDataType().isKindOf(StructuredDataType) and self.getDataType().member->contains(m)).println();
+ } else {
+ (self.reduction->at(self.reduction->indexOf(m)-1).dataType.isKindOf(StructuredDataType)
+ and self.reduction->at(self.reduction->indexOf(m)-1).dataType.member->contains(m)).println();
+ }
+ }
+ //return
+ (" => " +(
+ not self.getDataType().isKindOf(StructuredDataType)
+ or self.reduction.isEmpty()
+ or self.getDataType().member->contains(self.reduction->first())
+ and self.reduction->select(m|
+ self.reduction->indexOf(m) > 0)->forAll(m|
+ self.reduction->at(self.reduction->indexOf(m)-1).dataType.isKindOf(StructuredDataType)
+ and self.reduction->at(self.reduction->indexOf(m)-1).dataType.member->contains(m)
+ )
+ )).println();
+
+ return true;
+}
+
+operation Any debugFirstBlock() : Boolean {
+ self.block->forAll(b|b.behaviour.oclIsKindOf(CombinedBehaviour));
+// for (x in self.block->closure(i|i.behaviour.oclIsKindOf(CombinedBehaviour) and i.behaviour.first().block)) {
+ // (x).println();
+ //}
+ return true;
+}
+
+operation Any validateBindings() : Boolean {
+ //for (c in TDL!Connection.allInstances()) {
+ //c.~notMatched = false;
+ //}
+ //("Test Description: " + self.getTestDescription().qualifiedName()).println();
+ //(" Context TC: " + self.getTestDescription().testConfiguration.qualifiedName()).println();
+ //(" TD Reference " + self.testDescription.qualifiedName()).println();
+ //(" Referenced TC: " + self.testDescription.testConfiguration.qualifiedName()).println();
+
+ //constraint:
+ var sameConfigurationNoBindings =
+ self.getTestDescription().testConfiguration = self.testDescription.testConfiguration
+ and self.componentInstanceBinding.isEmpty();
+
+ if (sameConfigurationNoBindings) {
+ return true;
+ }
+
+ (self.testDescription.name + " referenced in " + self.getTestDescription().name).println();
+
+ for (c in self.testDescription.testConfiguration.connection) {
+ (" Required connection: "+c.endPoint.get(0).qualifiedName()+" --- "+c.endPoint.get(1).qualifiedName()).println();
+
+ //actual constraint
+ //note slight redundacy due to reflectivity (a--b == b--a)
+ //which can be expressed also more succinctly
+ //constraint
+ var matchedConnection =
+ //bindings for formal components exist
+ self.testDescription.testConfiguration.connection.forAll(c |
+ self.componentInstanceBinding->exists(i |
+ i.formalComponent = c.endPoint.get(0).component)
+ and self.componentInstanceBinding->exists(i |
+ i.formalComponent = c.endPoint.get(1).component))
+ and
+ //provided -> select matched -> check matched
+ self.getTestDescription().testConfiguration.connection->select(p |
+ (p.endPoint.get(0).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint.get(0).component).first().actualComponent
+ and p.endPoint.get(1).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint.get(1).component).first().actualComponent)
+ or (p.endPoint.get(1).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint.get(0).component).first().actualComponent
+ and p.endPoint.get(0).component = self.componentInstanceBinding->select(i |
+ i.formalComponent = c.endPoint.get(1).component).first().actualComponent))->exists(m |
+ (m.endPoint.get(0).gate.type = c.endPoint.get(0).gate.type
+ and m.endPoint.get(1).gate.type = c.endPoint.get(1).gate.type)
+ or (m.endPoint.get(0).gate.type = c.endPoint.get(1).gate.type
+ and m.endPoint.get(1).gate.type = c.endPoint.get(0).gate.type));
+ if (not matchedConnection) {
+ (" -> ERROR: No matching connections found for bound components! Binding not posible!").errln();
+ }
+
+ }
+
+ return true;
+}
+
+
+operation Any debugBindings() : Boolean {
+ //for (c in TDL!Connection.allInstances()) {
+ //c.~notMatched = false;
+ //}
+ //("Test Description: " + self.getTestDescription().qualifiedName()).println();
+ //(" Context TC: " + self.getTestDescription().testConfiguration.qualifiedName()).println();
+ //(" TD Reference " + self.testDescription.qualifiedName()).println();
+ //(" Referenced TC: " + self.testDescription.testConfiguration.qualifiedName()).println();
+
+ //constraint:
+ var sameConfigurationNoBindings =
+ self.getTestDescription().testConfiguration = self.testDescription.testConfiguration
+ and self.componentInstanceBinding.isEmpty();
+
+ if (sameConfigurationNoBindings) {
+ return true;
+ }
+
+ (self.testDescription.name + " referenced in " + self.getTestDescription().name).println();
+
+ for (c in self.testDescription.testConfiguration.connection) {
+ (" Required connection: "+c.endPoint.get(0).qualifiedName()+" --- "+c.endPoint.get(1).qualifiedName()).println();
+ var formalE1 = c.endPoint.get(0).component;
+ var formalE2 = c.endPoint.get(1).component;
+
+ //constraint
+ var bindingsForFormalComponentsExist =
+ self.testDescription.testConfiguration.connection.forAll(c |
+ self.componentInstanceBinding.exists(i|i.formalComponent = c.endPoint.get(0).component)
+ and self.componentInstanceBinding.exists(i|i.formalComponent = c.endPoint.get(1).component)
+ );
+
+ if (bindingsForFormalComponentsExist) {
+ var actualE1 = self.componentInstanceBinding.select(i|i.formalComponent = formalE1).first().actualComponent;
+ var actualE2 = self.componentInstanceBinding.select(i|i.formalComponent = formalE2).first().actualComponent;
+ (" Relevant Bindings:").println();
+ (" "+formalE1.qualifiedName()+" --> "+actualE1.qualifiedName()).println();
+ (" "+formalE2.qualifiedName()+" --> "+actualE2.qualifiedName()).println();
+
+ var providedConnections = self.getTestDescription().testConfiguration.connection;
+ for (p in providedConnections) {
+ (" Provided connections: "+p.endPoint.get(0).qualifiedName()+" <---> "+p.endPoint.get(1).qualifiedName()).println();
+ }
+ //actual constraint
+ //note slight redundacy due to reflectivity (a--b == b--a)
+ //which can be expressed also more succinctly
+ //constraint
+ var matchedConnections =
+ providedConnections.select(p |
+ (p.endPoint.get(0).component = actualE1 and p.endPoint.get(1).component = actualE2)
+ or (p.endPoint.get(1).component = actualE1 and p.endPoint.get(0).component = actualE2));
+ if (matchedConnections.size()=0) {
+ (" -> ERROR: No matching connections found for bound components! Binding not posible!").errln();
+
+ } else {
+ (" -> "+matchedConnections.size() + " matching connections found for bound components").println();
+ for (m in matchedConnections) {
+ if ((m.endPoint.get(0).gate.type = c.endPoint.get(0).gate.type
+ and
+ m.endPoint.get(1).gate.type = c.endPoint.get(1).gate.type)
+ or
+ (m.endPoint.get(0).gate.type = c.endPoint.get(1).gate.type
+ and
+ m.endPoint.get(1).gate.type = c.endPoint.get(0).gate.type)) {
+
+ } else {
+ (" -> ERROR: Correspoonding gate types <"+m.endPoint.get(0).gate.type.name+","+m.endPoint.get(1).gate.type.name+"> for gates <"+m.endPoint.get(0).name+","+m.endPoint.get(1).name+"> are not the same as the required gate types <"+c.endPoint.get(0).gate.type.name+","+c.endPoint.get(1).gate.type.name+">! Binding not posible!").errln();
+
+ }
+ }
+ }
+ } else {
+ (" -> ERROR: There are no bindings corresponding to the components for the required connection! Binding not posible!").errln();
+ }
+
+ }
+
+ return true;
+}
+
+
diff --git a/plugins/org.etsi.mts.tdl.constraints/epsilon/library/helper.eol b/plugins/org.etsi.mts.tdl.constraints/epsilon/library/helper.eol
new file mode 100644
index 0000000000000000000000000000000000000000..113a1030b6dd0b9eabcd1fddb0d7d1bbc10d202d
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/epsilon/library/helper.eol
@@ -0,0 +1,136 @@
+//Helper operations
+
+operation TDL!Package targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation TDL!Member targetElement() : String {
+ return self.eContainer.qualifiedName()+"::"+self.name;
+}
+
+operation TDL!ElementImport targetElement() : String {
+ return self.qualifiedName()+"::Import " +self.importedElement.collect(e|e.name).concat(",")+ " from "+self.importedPackage.qualifiedName();
+}
+
+
+operation TDL!MemberAssignment targetElement() : String {
+ return self.qualifiedName()+self.member.name + " = " +self.memberSpec.targetElement();
+}
+
+operation TDL!DataInstanceUse targetElement() : String {
+ return self.dataInstance.qualifiedName();
+}
+
+operation TDL!DataInstance targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation TDL!FunctionCall targetElement() : String {
+ return self.`function`.qualifiedName();
+}
+
+operation TDL!FormalParameterUse targetElement() : String {
+ return self.parameter.qualifiedName();
+}
+
+operation TDL!VariableUse targetElement() : String {
+ return self.variable.qualifiedName();
+}
+
+
+operation TDL!ParameterBinding targetElement() : String {
+ return self.parameter.qualifiedName() +" = ?:"+self.dataUse.getDataType().name+ " [Expecting "+self.parameter.dataType.name+"]";
+}
+
+operation TDL!AnyValueOrOmit targetElement() : String {
+ return "*";
+}
+
+operation TDL!AnyValue targetElement() : String {
+ return "?";
+}
+
+operation TDL!OmitValue targetElement() : String {
+ return "omit";
+}
+
+operation TDL!TimeLabelUse targetElement() : String {
+ return self.timeLabel.qualifiedName();
+}
+
+operation TDL!ComponentInstance targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation TDL!ComponentType targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation TDL!Comment targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation TDL!Action targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation TDL!AnnotationType targetElement() : String {
+ return self.qualifiedName();
+}
+
+
+operation TDL!TimeConstraint targetElement() : String {
+ return 'TimeConstraint';
+}
+
+operation TDL!Quiescence targetElement() : String {
+ return 'Q';
+}
+
+operation TDL!Wait targetElement() : String {
+ return 'W';
+}
+
+operation TDL!TimerOperation targetElement() : String {
+ return self.timer.qualifiedName();
+}
+
+operation TDL!GateReference targetElement() : String {
+ return self.component.qualifiedName()+ "." + self.gate.qualifiedName();
+}
+
+operation TDL!Connection targetElement() : String {
+ return self.endPoint.at(0).targetElement()+ " --- " + self.endPoint.at(1).targetElement();
+}
+
+operation TDL!TestConfiguration targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation TDL!Block targetElement() : String {
+ return self.qualifiedName() + "Block";
+}
+
+operation TDL!Behaviour targetElement() : String {
+ return self.qualifiedName() + self.type().name;
+}
+
+operation TDL!Target targetElement() : String {
+ return self.qualifiedName() + self.type().name;
+}
+
+operation TDL!ComponentInstanceBinding targetElement() : String {
+ return self.qualifiedName() + "Binding";
+}
+
+operation TDL!Function targetElement() : String {
+ return self.qualifiedName();
+}
+
+operation Any targetElement() : String {
+ if (self.isDefined()) {
+ return "[not implemented "+self+"]";
+ } else {
+ return "";
+ }
+}
diff --git a/plugins/org.etsi.mts.tdl.constraints/reference/es_20311901v010301m__PM__ORIGINAL.evl b/plugins/org.etsi.mts.tdl.constraints/reference/es_20311901v010301m__PM__ORIGINAL.evl
new file mode 100644
index 0000000000000000000000000000000000000000..752f1f3b8f3ed996ae6e3f5bb68709f33390632c
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/reference/es_20311901v010301m__PM__ORIGINAL.evl
@@ -0,0 +1,877 @@
+//Main Replacement Patterns
+//^ (.+)\n inv (\w+)\:(.+)\n
+// constraint \2 {\n check: \3\n message: "\1"\n }\n
+//guard -> ^guard
+//function -> ^function
+//^context -> 1context
+//^(\w|\') -> //\1
+//some more
+
+context Foundation {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context NamedElement {
+//Constraints
+//Mandatory name
+ constraint MandatoryName {
+ check: not self.name.oclIsUndefined() and self.name.size() > 0
+ message: "A 'NamedElement' shall have the 'name' property set and the 'name' shall be not an empty String."
+ }
+//Distinguishable qualified names
+ constraint DistinguishableName {
+ check: NamedElement.allInstances()->forAll(e1,e2 | e1 <> e2 implies e1.qualifiedName <> e2.qualifiedName)
+ message: "All qualified names of instances of the same meta-class shall be distinguishable within a TDL model."
+ }
+//NOTE: It is up to the concrete syntax definition and tooling to resolve any name clashes between instances of the same meta-class in the qualified name.
+}
+
+context PackageableElement {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Package {
+//Constraints
+//No cyclic imports
+ constraint CyclicImports {
+ check: self.^import->asOrderedSet()->closure(^import.importedPackage)->forAll(i | i <> self)
+ message: "A 'Package' shall not import itself directly or indirectly."
+ }
+
+}
+
+context ElementImport {
+//Constraints
+//Consistency of imported elements
+ constraint ConsistentImports {
+ check: self.importedElement->forAll(e | self.importedPackage.packagedElement->contains(e))
+ message: "All imported 'PackageableElement's referenced by an 'ElementImport' shall be directly owned by the imported 'Package'."
+ }
+
+//Figure 5.2: Miscellaneous elements
+
+}
+
+context Comment {
+//Constraints
+//No nested comments
+ constraint CommentNestedComments {
+ check: self.comment->isEmpty()
+ message: "A 'Comment' shall not contain 'Comment's."
+ }
+//No annotations to comments
+ constraint CommentNestedAnnotations {
+ check: self.annotation->isEmpty()
+ message: "A 'Comment' shall not contain 'Annotation's."
+ }
+
+}
+
+context DataElementMapping {
+//Constraints
+//No nested annotations
+ constraint AnnotationNestedComments {
+ check: self.annotation->isEmpty()
+ message: "An 'Annotation' shall not contain 'Annotation's."
+ }
+//No comments to annotations
+ constraint AnnotationNestedComments {
+ check: self.comment->isEmpty()
+ message: "An 'Annotation' shall not contain 'Comment's."
+ }
+
+}
+
+context AnnotationType {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context TestObjective {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Data {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context MappableDataElement {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context DataElementMapping {
+//Constraints
+//Restricted use of parameter mapping
+ constraint ParameterMappingType {
+ check: self.parameterMapping.size() = 0 or (self.mappableDataElement.isTypeOf(StructuredDataType) or self.mappableDataElement.isTypeOf(Action) or self.mappableDataElement.isTypeOf(Function))
+ message: "A set of 'ParameterMapping's shall only be provided if 'mappableDataElement' refers to a 'StructuredDataType', an 'Action' or a 'Function' definition."
+ }
+
+}
+
+context ParameterMapping {
+//Constraints
+//There are no constraints specified.
+
+//Figure 6.2: Basic data concepts and simple data
+
+}
+
+context DataType {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context DataInstance {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context SimpleDataType {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context SimpleDataInstance {
+//Constraints
+//SimpleDataInstance shall refer to SimpleDataType
+ constraint SimpleDataInstanceType {
+ check: self.dataType.oclIsTypeOf(SimpleDataType)
+ message: "The inherited reference 'dataType' from 'DataInstance' shall refer to instances of 'SimpleDataType' solely."
+ }
+
+//Figure 6.3: Structured data type and instance
+
+}
+
+context StructuredDataType {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Member {
+//Constraints
+//Different member names in a structured data type
+ constraint DistinguishableMemberName {
+ check: self.oclContainer().member->forAll(e1,e2 | e1 <> e2 implies e1.name <> e2.name)
+ message: "All 'Member' names of a 'StructuredDataType' shall be distinguishable."
+ }
+
+}
+
+context StructuredDataInstance {
+//Constraints
+//StructuredDataInstance shall refer to StructuredDataType
+ constraint StructuredDataInstanceType {
+ check: self.dataType.oclIsTypeOf(StructuredDataType)
+ message: "The inherited reference 'dataType' from 'DataInstance' shall refer to instances of 'StructuredDataType' solely."
+ }
+
+}
+
+context MemberAssignment {
+//Constraints
+//'Member' of the 'StructuredDataType'
+ constraint ExistingMemberOfDataType {
+ check: self.oclContainer().dataType.member->contains(self.member)
+ message: "The referenced 'Member' shall be contained in the 'StructuredDataType' that the 'StructuredDataInstance', which contains this 'MemberAssignment', refers to."
+ }
+//Type of a 'memberSpec' and 'Member' shall coincide
+ constraint MatchingMemberDataType {
+ check: self.memberSpec.getDataType() = self.member.dataType
+ message: "The 'DataType' of the 'StaticDataUse' of 'memberSpec' shall coincide with the 'DataType' of the 'Member' of the 'MemberAssignment'."
+ }
+//Restricted use of 'OmitValue' for optional 'Member's only
+ constraint OmitValueUse {
+ check: self.memberSpec.oclIsTypeOf(OmitValue) implies self.member.isOptional = true
+ message: "A non-optional 'Member' shall have a 'StaticDataUse' specification assigned to it that is different from 'OmitValue'."
+ }
+
+//Figure 6.4: Action, function, parameter and variable
+
+}
+
+context Parameter {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context FormalParameter {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Variable {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Action {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Function {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context DataUse {
+//Constraints
+//TODO:
+//No mixed use of 'Member' and 'FormalParameter' in 'argument' set
+// All 'ParameterBinding's that are referenced in the 'argument' set shall refer only to one kind of 'Member' or 'FormalParameter'.
+//Occurrence of 'argument' and 'reduction'
+ constraint FunctionCallUse {
+ check: self.argument.isEmpty() or self.reduction.isEmpty() or self.oclIsTypeOf(FunctionCall)
+ message: "Both, 'argument' and 'reduction', may be provided only in case of a 'FunctionCall'."
+ }
+//TODO:
+//Structured data types in 'reduction' set
+// A 'Member' at index i of a 'reduction' shall be contained in the 'StructuredDataType' of the 'Member' at index(i - 1) of that 'reduction'.
+
+}
+
+context ParameterBinding {
+//Constraints
+//Matching data type
+ constraint ParameterBindingTypes {
+ check: self.dataUse.getDataType() = self.parameter.dataType
+ message: "The provided 'DataUse' shall match the 'DataType' of the referenced 'Parameter'."
+ }
+//Use of a 'StructuredDataInstance' with non-optional 'Member's
+ constraint OmitValueParameter {
+ check: self.parameter.oclIsTypeOf(Member) and self.parameter.oclAsType(Member).isOptional = false implies not self.dataUse.oclIsTypeOf(OmitValue)
+ message: "A non-optional 'Member' of a 'StructuredDataType' shall have a 'DataUse' specification assigned to it that is different from 'OmitValue'."
+ }
+
+}
+
+context StaticDataUse {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context DataInstanceUse {
+//Constraints
+//Either argument list or reduction list provided
+ constraint DataInstanceUseArgumentReduction {
+ check: self.argument->isEmpty() or self.reduction->isEmpty()
+ message: "Either one of the 'argument' list or 'reduction' list or none of them shall be provided."
+ }
+//Static data use in structured data
+ constraint StructuredDataInstanceUse {
+ check: self.dataInstance. oclIsTypeOf(StructuredDataInstance) implies self.argument->forAll(a | a.dataUse.oclIsTypeOf(StaticDataUse))
+ message: "If the 'DataInstance' refers to a 'StructuredDataInstance', all of its 'ParameterBinding's shall refer to 'StaticDataUse'."
+ }
+
+}
+
+context SpecialValueUse {
+//Constraints
+//Empty 'argument' and 'reduction' sets
+ constraint SpecialValueUseArgumentReduction {
+ check: self.argument->isEmpty() and self.reduction->isEmpty()
+ message: "The 'argument' and 'reduction' sets shall be empty."
+ }
+
+}
+
+context AnyValue {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context AnyValueOrOmit {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context OmitValue {
+//Constraints
+//There are no constraints specified.
+
+//Figure 6.6: Dynamic data use
+
+}
+
+context DynamicDataUse {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context FunctionCall {
+//Constraints
+//Matching parameters
+ constraint FunctionCallParameters {
+ check: self.^function.formalParameter->size() = self.argument->size() and self.argument->forAll(ap | ap.getDataType() = self.^function.formalParameter.at(self.argument.indexOf(ap)).dataType)
+ message: "The arguments specified by the 'ParameterBinding' shall match (in terms of number and data type) the list of 'FormalParameter's of the invoked 'Function'."
+ }
+
+}
+
+context FormalParameterUse {
+//Constraints
+//Either argument list or reduction list provided
+ constraint FormalParameterUseArgumentReduction {
+ check: (self.argument->isEmpty() and self.reduction->isEmpty()) or (self.argument->isEmpty() or self.reduction->isEmpty())
+ message: "Either one of the 'argument' list or 'reduction' list or none of them shall be provided."
+ }
+
+}
+
+context VariableUse {
+//Constraints
+//Either argument list or reduction list provided
+ constraint VariableUseArgumentReduction {
+ check: (self.argument->isEmpty() and self.reduction->isEmpty()) or (self.argument->isEmpty() or self.reduction->isEmpty())
+ message: "Either one of the 'argument' list or 'reduction' list or none of them shall be provided."
+ }
+//Local variables of tester components only
+ constraint VariableUseComponentRole {
+ check: self.componentInstance.type.variable->contains(self.variable) and self.componentInstance.role = Tester
+ message: "All variables used in a 'DataUse' specification via a 'VariableUse' shall be local to the same 'componentInstance' and the 'componentInstance' shall be in the role 'Tester'."
+ }
+
+}
+
+context Time {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context TimeLabel {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context TimeLabelUse {
+//Constraints
+//Empty argument and reduction lists
+ constraint TimeLabelUseArgumentReduction {
+ check: self.argument->isEmpty() and self.reduction->isEmpty()
+ message: "The 'argument' and 'reduction' lists shall be empty."
+ }
+
+}
+
+context TimeConstraint {
+//Constraints
+//Time constraint expression of type Boolean
+ constraint TimeConstraintType {
+ check: self.timeConstraintExpression.getDataType().name = 'Boolean'
+ message: "The expression given in the 'DataUse' specification shall evaluate to predefined type 'Boolean'."
+ }
+
+//TODO:
+//Use of local variables only
+// The expression given in the 'DataUse' specification shall contain only 'Variable's that are local to the 'AtomicBehaviour' that contains this time constraint. That is, all 'Variable's shall be referenced in the 'ComponentInstance' that executes the 'AtomicBehaviour'.
+
+}
+
+context TimeOperation {
+//Constraints
+//Time operations on tester components only
+ constraint TimeOperationComponentRole {
+ check: self.componentInstance.role = Tester
+ message: "A 'TimeOperation' shall be performed only on a 'ComponentInstance' in the role 'Tester'."
+ }
+//'Time' data type for period expression
+ constraint TimePeriodType {
+ check: self.period.getDataType().name = 'Time'
+ message: "The 'DataUse' expression assigned to the 'period' shall evaluate to a data instance of the 'Time' data type."
+ }
+
+}
+
+context Wait {
+//Constraints
+//Tester component for 'Wait' shall be known
+ constraint WaitTarget {
+ check: (not self.componentInstance.oclIsUndefined()) and self.componentInstance.role = Tester
+ message: "The relation to a 'ComponentInstance' of a 'Wait' shall be set and refer to a 'Tester' component instance."
+ }
+
+}
+
+context Quiescence {
+//Constraints
+//Exclusive use of gate reference or component instance
+ constraint QuiescenceTarget {
+ check: self.gateReference.oclIsUndefined() or self.componentInstance.oclIsUndefined()
+ message: "If a 'GateReference' is provided, a 'ComponentInstance' shall be not provided and vice versa."
+ }
+
+//Figure 7.3: Timer and timer operations
+
+}
+
+context Timer {
+//Constraints
+//Initial state of a timerWhen a timer is defined, it is operationally in the state idle.
+
+}
+
+context TimerOperation {
+//Constraints
+//Timer operations on tester components only
+ constraint TimerOperationComponentRole {
+ check: self.componentInstance.role = Tester
+ message: "A 'TimerOperation' shall be performed only on a 'ComponentInstance' in the role 'Tester'."
+ }
+
+}
+
+context TimerStart {
+//Constraints
+//'Time' data type for period expression
+ constraint TimerPeriodType {
+ check: self.period.getDataType().name = 'Time'
+ message: "The 'DataUse' expression assigned to the 'period' shall evaluate to a data instance of the 'Time' data type."
+ }
+
+}
+
+context TimerStop {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context TimeOut {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context TestConfiguration {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context GateInstance {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context ComponentType {
+//Constraints
+//There are no constraints specified.
+
+//Figure 8.2: Test configuration
+
+}
+
+context ComponentInstance {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context ComponentInstanceRole {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context GateReference {
+//Constraints
+//Gate instance of the referred component instance
+ constraint GateInstanceReference {
+ check: self.component.type.gateInstance->contains(self.gate)
+ message: "The referred 'GateInstance' shall be contained in the 'ComponentType' of the referred 'ComponentInstance'."
+ }
+
+}
+
+context Connection {
+//Constraints
+//Self-loop connections are not permitted
+ constraint NoSelfLoop {
+ check: self.endPoint->forAll(e1, e2 | not (e1.gate = e2.gate and e1.component = e2.component))
+ message: "The 'endPoint's of a 'Connection' shall not be the same. Two endpoints are the same if both, the referred 'ComponentInstance's and the referred 'GateInstance's, are identical."
+ }
+//Consistent type of a connection
+ constraint ConsistentConnectionType {
+ check: self.endPoint->forAll(e1, e2 | e1.gate.type = e2.gate.type)
+ message: "The 'GateInstance's of the two 'endPoint's of a 'Connection' shall refer to the same 'GateType'."
+ }
+
+}
+
+context TestConfiguration {
+//Constraints
+//'TestConfiguration' and components roles
+ constraint ComponentRoles {
+ check: self.componentInstance->exists(c | c.role = Tester) and self.componentInstance->exists(c | c.role = SUT)
+ message: "A 'TestConfiguration' shall contain at least one 'Tester' and one 'SUT' 'ComponentInstance'."
+ }
+//Minimal 'TestConfiguration'
+ constraint MinimalTestConfiguration {
+ check: self.connection->exists(c | (c.endPoint->at(0).componentInstance.role = Tester and c.endPoint->at(1).componentInstance.role = SUT) or (c.endPoint->at(0).componentInstance.role = SUT and c.endPoint->at(1).componentInstance.role = Tester))
+ message: "Each 'TestConfiguration' shall specify at least one 'Connection' that connects a 'GateInstance' of a 'ComponentInstance' in the role 'Tester' with a 'GateInstance' of a 'ComponentInstance' in the role 'SUT'."
+ }
+//At most one connection between any two 'GateInstance'/'ComponentInstance' pairs
+ constraint UniqueConnections {
+ check: self.connection->forAll (c1, c2 | not ( (c1.endPoint->at(0).componentInstance = c2.endPoint->at(0).componentInstance and c1.endPoint->at(0).gateInstance = c2.endPoint->at(0).gateInstance) and (c1.endPoint->at(1).componentInstance = c2.endPoint->at(1).componentInstance and c1.endPoint->at(1).gateInstance = c2.endPoint->at(1).gateInstance) ) and not ( (c1.endPoint->at(0).componentInstance = c2.endPoint->at(1).componentInstance and c1.endPoint->at(0).gateInstance = c2.endPoint->at(1).gateInstance) and (c1.endPoint->at(1).componentInstance = c2.endPoint->at(0).componentInstance and c1.endPoint->at(1).gateInstance = c2.endPoint->at(0).gateInstance) ))
+ message: "Given the set of 'Connection's contained in a 'TestConfiguration'. There shall be no two 'Connection's containing 'GateReference's that in turn refer to identical pairs of 'GateInstance'/'ComponentInstance'."
+ }
+
+}
+
+context TestBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context BehaviourDescription {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Behaviour{
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Block {
+//Constraints
+//Guard shall evaluate to Boolean
+ constraint GuardType {
+ check: self.^guard.oclIsUndefined() or self.^guard.getDataType().name = 'Boolean'
+ message: "The type of 'guard' shall be 'Boolean'."
+ }
+
+}
+
+context CombinedBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context SingleCombinedBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context CompoundBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context BoundedLoopBehaviour {
+//Constraints
+//No guard constraint
+ constraint BoundedGuard {
+ check: self.block.^guard.oclIsUndefined()
+ message: "The 'Block' of a 'BoundedLoopBehaviour' shall not have a 'guard'."
+ }
+//TODO:
+//Iteration number shall be countable and positive
+// The expression assigned to the 'numIteration' property shall evaluate to a countable 'SimpleDataInstance' of an arbitrary user-defined data type, e.g. a positive Integer value.
+
+}
+
+context UnboundedLoopBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context MultipleCombinedBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context AlternativeBehaviour {
+//Constraints
+//Number of 'Block's
+ constraint AlternativeBlockCount {
+ check: self.block->size() > 1
+ message: "An 'AlternativeBehaviour' shall contain at least two 'Block's. "
+ }
+//TODO:
+//First behaviour of 'Block's
+// Each block of an 'AlternativeBehaviour' shall start with a tester-input event.
+
+}
+
+context ConditionalBehaviour {
+//Constraints
+//Guard for 'ConditionalBehaviour' with single block
+ constraint ConditionalFirstGuard {
+ check: not self.block->first().^guard.oclIsUndefined()
+ message: "If there is only one 'Block' specified, it shall have a 'guard'."
+ }
+//Possible else block for 'ConditionalBehaviour' with multiple blocks
+ constraint ConditionalLastGuard {
+ check: self.block->forAll(b | b = self.block.last() or not b.^guard.oclIsUndefined())
+ message: "All 'Block's specified, except the last one, shall have a 'guard'."
+ }
+//TODO:
+//First 'AtomicBehaviour' allowed
+// The first 'AtomicBehaviour' of any 'Block' of a 'ConditionalBehaviour' shall not be a tester-input event.
+
+}
+
+context ParallelBehaviour {
+//Constraints
+//Number of blocks in 'ParallelBehaviour'
+ constraint ParallelBlockCount {
+ check: self.block->size() > 1
+ message: "There shall be at least two 'Block's specified."
+ }
+
+//Figure 9.3: Exceptional and periodic behaviour
+
+}
+
+context ExceptionalBehaviour {
+//Constraints
+//No guard
+ constraint ExceptionalGuard {
+ check: self.block.^guard.oclIsUndefined()
+ message: "The 'Block' shall have no guard."
+ }
+//TODO:
+//First 'AtomicBehaviour' in block allowed
+// Each block of an 'ExceptionalBehaviour' shall start with a tester-input event.
+//Guarded component shall be a 'Tester' component
+ constraint ExceptionalGuardedComponent {
+ check: self.guardedComponent.role = Tester
+ message: "The 'guardedComponent' shall refer to a 'ComponentInstance' with the role of 'Tester'."
+ }
+
+}
+
+context DefaultBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context InterruptBehaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context PeriodicBehaviour {
+//Constraints
+//TODO:
+//First 'AtomicBehaviour' allowed
+// The first 'AtomicBehaviour' of any 'Block' of a 'PeriodicBehaviour' shall not be a tester-input event.
+//'Time' data type for period expression
+ constraint PeriodType {
+ check: self.period.getDataType().name = 'Time'
+ message: "The 'DataUse' expression assigned to the 'period' shall evaluate to a data instance of the 'Time' data type."
+ }
+
+}
+
+context Behaviour {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Break {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Stop {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context VerdictAssignment {
+//Constraints
+//Verdict of type 'Verdict'
+ constraint VerdictType {
+ check: self.verdict.getDataType().name = 'Verdict'
+ message: "The 'verdict' shall evaluate to a, possibly predefined, instance of a 'SimpleDataInstance' of data type 'Verdict'."
+ }
+
+}
+
+context Assertion {
+//Constraints
+//Boolean condition
+ constraint AssertionOtherwise {
+ check: self.condition.getDataType().name = 'Boolean'
+ message: "The 'condition' shall evaluate to predefined 'DataType' 'Boolean'."
+ }
+//Otherwise of type 'Verdict'
+ constraint AssertionOtherwise {
+ check: self.otherwise.getDataType().name = 'Verdict'
+ message: "The 'otherwise' shall evaluate to a, possibly predefined, instance of a 'SimpleDataInstance' of data type 'Verdict'."
+ }
+
+//Figure 9.5: Interaction behaviour
+
+}
+
+context Interaction {
+//Constraints
+//Gate references of an interaction shall be different
+ constraint DistinctInteractionGates {
+ check: not self.target->exists(t | t.targetGate = self.sourceGate)
+ message: "All 'GateReference's that act as source or target(s) of an 'Interaction' shall be different from each other."
+ }
+//Gate references of an interaction shall be connected
+ constraint ConnectedInteractionGates {
+ check: self.target.forAll(t | Connection.allInstances()->exists(c | (c.endPoint.at(0) = sourceGate and c.endPoint.at(1) = t.targetGate) or (c.endPoint.at(1) = sourceGate and c.endPoint.at(0) = t.targetGate)))
+ message: "The 'GateReference's that act as source or target(s) of an 'Interaction' shall be interconnected by a 'Connection'."
+ }
+//Type of interaction argument
+ constraint InteractionArgumentAndGateType {
+ check: self.sourceGate.dataType = self.argument.getDataType() and self.target.forAll(t | t.targetGate.dataType = self.argument.getDataType())
+ message: "The 'DataUse' specification referred to in the 'argument' shall match one of the 'DataType's referenced in the 'GateType' definition of the 'GateInstance's referred to by the source and target 'GateReference's of the 'Interaction'."
+ }
+//TODO:
+//Use of variables in the 'argument' specification
+// The use of 'Variable's in the 'DataUse' specification shall be restricted to 'Variable's of 'ComponentInstance's that participate in this 'Interaction' via the provided 'GateReference's.
+//Matching data type for 'argument' and 'variable'
+ constraint InteractionArgumentAndVariableType {
+ check: self.target.forAll(t | t.variable.oclIsUndefined or t.variable.type = self.argument.getDataType())
+ message: "The 'DataUse' specification of the 'argument' and the referenced 'Variable' of any 'Target' shall refer to the same 'DataType'."
+ }
+
+}
+
+context Target {
+//Constraints
+//Variable and target gate of the same component instance
+ constraint TargetComponent {
+ check: self.targetGate.component.type.variable->contains(self.variable)
+ message: "The referenced 'Variable' shall exist in the same 'ComponentType' as the 'GateInstance' that is referred to by the 'GateReference' of the 'targetGate'."
+ }
+//Variable of a tester component only
+ constraint TargetVariableComponentRole {
+ check: self.variable.oclIsUndefined() or self.targetGate.component.role = Tester
+ message: "If a 'Variable' is specified, the 'ComponentInstance' referenced by 'targetGate' shall be in the role 'Tester'."
+ }
+
+
+}
+
+context TestDescriptionReference {
+//Constraints
+//Number of actual parameters
+ constraint ParameterCount {
+ check: self.actualParameter.size() = self.testDescription.formalParameter.size()
+ message: "The number of actual parameters in the 'TestDescriptionReference' shall be equal to the number of formal parameters of the referenced 'TestDescription'."
+ }
+//TODO:
+//No use of variables in actual parameters
+// The 'DataUse' expressions used to describe actual parameters shall not contain variables directly or indirectly.
+//Matching parameters
+ constraint TestDescriptionParameters {
+ check: self.actualParameter.forAll(ap | ap.getDataType() = self.testDescription.formalParameter.at(self.actualParameter.indexOf(ap)).dataType)
+ message: "The actual parameter AP[i] of index i in the ordered list of 'actualParameter's shall match 'DataType' of the 'FormalParameter' FP[i] of index i in the ordered list of formal parameters of the referenced 'TestDescription'."
+ }
+//TODO:
+//Restriction to 1:1 component instance bindings
+// If component instance bindings are provided, the component instances referred to in the bindings shall occur at most once for the given test description reference.
+/*Compatible test configurations
+ The test configuration TConf2 of the referenced (invoked) test description shall be compatible with the test configuration TConf1 of the referencing (invoking) test description under the provision of a list of bindings between component instances in TConf1 and TConf2. Compatibility is then defined in the following terms:
+ All component instances in TConf2 can be mapped to component instances of TConf1.A component instance B of test configuration TConf2 can be mapped to a component instance A of test configuration TConf1if and only if:
+ a) there is a binding pair (A, B) provided;
+ b) A and B refer to the same component type; and
+ c) A and B have the same component instance role {SUT, Tester} assigned.
+ All connections between component instances in TConf2 exist also between the mapped component instances in TConf1 and the type of a connection in TConf2 equals the type of the related connection in TConf1.Two connections of the two test configurations are equal if and only if the same gate instances are used in the definition of the gate references of the connections.
+ NOTE 1: The compatibility between test configurations is defined asymmetrically. That is, if TConf2 is compatible with TConf1, it does not imply that TConf1is compatible with TConf2. If TConf2 is compatible with TConf1, it is said that TConf2 is a sub-configuration of TConf1 under a given binding.
+ NOTE 2: If two test configurations are equal, then they are also compatible.
+*/
+}
+
+context ComponentInstanceBinding {
+//Constraints
+//Matching component types
+ constraint BindingComponentTypes {
+ check: self.formalComponent.type = self.actualComponent.type
+ message: "Both, the formal and the actual component instances, shall refer to the same 'ComponentType'."
+ }
+//Matching component instance roles
+ constraint BindingComponentRoles {
+ check: self.formalComponent.role = self.actualComponent.role
+ message: "Both, the formal and the actual component instances, shall have the same 'ComponentInstanceRole' assigned to."
+ }
+}
+
+context ActionBehaviour {
+//Constraints
+ constraint ActionBehaviourComponentRole {
+ check: self.componentInstance.oclIsUndefined() or self.componentInstance.role = Tester
+ message: "'ActionBehaviour' on 'Tester' components onlyThe 'ComponentInstance' that an 'ActionBehaviour' refers to shall be of role 'Tester'."
+ }
+
+}
+
+context ActionReference {
+//Constraints
+//Matching parameters
+ constraint ActionParameters {
+ check: self.actualParameter.forAll(ap | ap.getDataType() = action.formalParameter.at(self.actualParameter.indexOf(ap)).dataType)
+ message: "The actual parameter AP[i] of index i in the ordered set of 'actualParameter's shall match the 'DataType' of the 'FormalParameter' FP[i] of index i in the ordered set of formal parameters of the referenced 'Action'."
+ }
+
+}
+
+context InlineAction {
+//Constraints
+//There are no constraints specified.
+
+}
+
+context Assignment {
+//Constraints
+//Known component instance
+ constraint AssignmentComponent {
+ check: not self.componentInstance.oclIsUndefined()
+ message: "The property 'componentInstance' shall be set to identify the 'Variable' in this 'Assignment'."
+ }
+//Matching data type
+ constraint AssignmentDataType {
+ check: self.expression.getDataType() = self.variable.dataType
+ message: "The provided 'DataUse' expression shall match the 'DataType' of the referenced 'Variable'."
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.etsi.mts.tdl.constraints/src/org/etsi/mts/tdl/constraints/evl/Validator.java b/plugins/org.etsi.mts.tdl.constraints/src/org/etsi/mts/tdl/constraints/evl/Validator.java
new file mode 100644
index 0000000000000000000000000000000000000000..d4f511d9b1c0b1280cc84c780dbca2d65f8db7ef
--- /dev/null
+++ b/plugins/org.etsi.mts.tdl.constraints/src/org/etsi/mts/tdl/constraints/evl/Validator.java
@@ -0,0 +1,130 @@
+package org.etsi.mts.tdl.constraints.evl;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.epsilon.common.parse.problem.ParseProblem;
+import org.eclipse.epsilon.common.util.StringProperties;
+import org.eclipse.epsilon.emc.emf.EmfModel;
+import org.eclipse.epsilon.emc.emf.EmfUtil;
+import org.eclipse.epsilon.emc.emf.InMemoryEmfModel;
+import org.eclipse.epsilon.eol.EolModule;
+import org.eclipse.epsilon.eol.IEolExecutableModule;
+import org.eclipse.epsilon.eol.exceptions.EolRuntimeException;
+import org.eclipse.epsilon.eol.exceptions.models.EolModelLoadingException;
+import org.eclipse.epsilon.eol.models.IModel;
+import org.eclipse.epsilon.eol.tools.MathTool;
+import org.eclipse.epsilon.etl.EtlModule;
+import org.eclipse.epsilon.evl.EvlModule;
+import org.eclipse.epsilon.evl.IEvlFixer;
+import org.eclipse.epsilon.evl.execute.UnsatisfiedConstraint;
+import org.eclipse.epsilon.profiling.Profiler;
+import org.eclipse.epsilon.profiling.ProfilerTargetSummary;
+import org.eclipse.epsilon.profiling.ProfilingExecutionListener;
+import org.etsi.mts.tdl.tdlPackage;
+import org.osgi.framework.Bundle;
+
+
+@SuppressWarnings("unused")
+public class Validator {
+
+ public List validate(Resource r) {
+ List violations = new ArrayList<>();
+ try {
+ String source = "epsilon/constraints/tdl.evl";
+ //TODO: also for TO?
+
+ Bundle bundle = Platform.getBundle("org.etsi.mts.tdl.constraints");
+ String moduleSource = bundle.getLocation().substring(15)+source;
+
+ IEolExecutableModule module = loadModule(moduleSource);
+
+ IModel tdlModel = getTDLModel(r, true, false);
+ tdlModel.load();
+ module.getContext().getModelRepository().addModel(tdlModel);
+
+ //execute
+ module.execute();
+
+ EvlModule m = (EvlModule) module;
+ violations.addAll(m.getContext().getUnsatisfiedConstraints());
+ for (UnsatisfiedConstraint constraint : m.getContext().getUnsatisfiedConstraints()) {
+ System.out.println(" " + constraint.getMessage());
+ }
+
+ tdlModel.dispose();
+ module.reset();
+
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return violations;
+ }
+
+ private IEolExecutableModule loadModule(String source) throws Exception, URISyntaxException {
+ IEolExecutableModule module = null;
+ if (source.endsWith("etl")) {
+ module = new EtlModule();
+ } else if (source.endsWith("eol")) {
+ module = new EolModule();
+ } else if (source.endsWith("evl")) {
+ module = new EvlModule();
+ } else {
+
+ }
+
+ module.parse(new File(source));
+
+ if (module.getParseProblems().size() > 0) {
+ System.err.println("Parse errors occured...");
+ for (ParseProblem problem : module.getParseProblems()) {
+ System.err.println(problem.toString());
+ }
+ }
+
+ return module;
+ }
+
+ public IModel getTDLModel(Resource resource, boolean read, boolean write) throws Exception {
+ EmfModel model;
+ model = new InMemoryEmfModel("TDL", resource, tdlPackage.eINSTANCE);
+ model.setStoredOnDisposal(write);
+ model.setReadOnLoad(read);
+ model.setCachingEnabled(true);
+ return model;
+ }
+
+}