Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/EXCEPTIONS.md: 55 added lines, 0 removed lines.
Original line number
Diff line number
Diff line
# Constraints without a fixture
Lines of the form `- Context::Name — reason` are counted as documented exclusions in the coverage
report instead of gaps. Two kinds only, both verified against the grammar and the scope provider.
**These constraints still have to be implemented.** A model that violates them can be built through
the graphical editor, an importer or an XMI file; it just cannot be written in the `.tdltx` syntax,
so this suite cannot test them.
## A. Not expressible in the textual syntax
The grammar or the scope provider makes the violation unwritable: what would violate the constraint
is either a parse error or an unresolved reference, never a constraint report.
- NamedElement::MandatoryName — every grammar rule that produces a NamedElement assigns a mandatory, non-empty identifier.
- ElementImport::ConsistentImports — the scope of `importedElement` is exactly `importedPackage.packagedElement`, so a foreign element does not link.
- Comment::CommentNestedComments — no rule returning a Comment assigns nested comments.
- Comment::CommentNestedAnnotations — no rule returning a Comment assigns annotations.
- Annotation::AnnotationNestedAnnotations — no rule returning an Annotation assigns nested annotations.
- Annotation::AnnotationNestedComments — no rule returning an Annotation assigns comments.
- StructuredDataInstance::ExistingMemberOfDataType — a member assignment's member is scoped to `allMembers()` of the instance's type, the same set the constraint checks.
- EnumDataType::EnumDataTypeExtensions — the `Enumerated` rule has no `extends` clause.
- EnumDataType::NoValueInEnumInstance — the enumeration value rule has no `= value` slot.
- MemberReference::MemberOrIndex — `member` and `collectionIndex` are exclusive grammar alternatives, each mandatory in its branch, so exactly one is always set.
- DataInstanceUse::NoItemWithDataInstance — the alternative that sets `dataInstance` admits no collection items.
- VariableUse::VariableUseComponent — without an effective component the variable itself does not link.
- TimeLabelUse::TimeLabelLocallyOrdered — time labels are scoped to their own test description, so a cross-description reference does not link.
- TimerOperation::TimerComponent — a timer only resolves through its effective component; without one the reference does not link.
- ProcedureCall::ProcedureCallTargetCount — both call rules have exactly one mandatory target.
- Target::TargetComponent — a value assignment's variable is scoped to the target component's own variables.
- ValueAssignment::AssignedProcedureParameter — the parameter is scoped to the called signature's parameters.
- GateReference::GateInstanceReference — a gate reference's gate is scoped to `component.type.allGates()`.
- TestConfiguration::OwnedComponents — a gate reference's component is scoped to the enclosing configuration.
- Block::AllowedBehaviourTypes — periodic and exceptional behaviours are reachable only through the `with { … }` fragments, which fill `periodic`/`exceptional`, never `Block.behaviour`.
- AlternativeBehaviour::AlternativeBlockCount — the grammar requires at least two blocks.
- ParallelBehaviour::ParallelBlockCount — the grammar requires at least two blocks.
- Message::DataTypeResolvable — the argument is mandatory in both message rules.
- LiteralValueUse::SpecifiedLiteralValue — the grammar admits exactly one of value, intValue and boolValue.
- PICSReference::MultiplePICS — the grammar forces an `and`/`or` comment on every reference after the first.
- RepeatedEventSequence::RepetitionOrInterval — repetitions and interval are exclusive grammar alternatives.
- EntityReference::EntityOrComponentInstance — entity and component instance are exclusive alternatives.
- Content::ContentOrValue — nested content and value are exclusive alternatives.
- VariantBinding::VariantBindingValues — the referenced value is scoped to the binding's own objective.
- ComponentAlias::AliasMandatoryName — the alias name is mandatory in the grammar.
## B. Cannot fail by construction — defects in the standard's OCL
These expressions can never evaluate to false, so the constraint text does not actually constrain
anything. They are candidates for correction in the standard rather than for a fixture.
- PredefinedFunctionCall::PredefinedFunctionCallParameters — the body is literally `true`.
- CollectionDataInstance::CollectionDataInstanceLengthConstraint — the body is literally `true`.
- RepeatedEventSequence::RepetitionCount — the body is literally `true`.
- RepeatedEventSequence::RepetitionInterval — the body is literally `true`.
- DataElementUse::DataInstanceOrArgumentsOrItemsInDataElementUse — falsifying the second disjunct requires a StructuredDataType and the third a CollectionDataType, so they cannot both be false.
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/README.md: 19 added lines, 0 removed lines.
Original line number
Diff line number
Diff line
# Constraint test suite fixtures
One `.tdltx` file per expectation, any folder depth. The grammar allows one package per file, so a fixture that needs several packages is a folder whose files are loaded together (files without a header are helpers). The header declares what a file violates:
//! expect NamedElement::DistinguishableName x2 -- exactly two reports
//! expect Package::CyclicImports -- at least one report
//! expect none -- conformant model, nothing may fire
//! allow SomeContext::SomeName -- may fire, ignored
Constraint ids are `Context::Name` as written in `org.etsi.mts.tdl.model/model/*.ocl`.
Each fixture is parsed, linked against `TDL.tdltx` and validated through Xtext's resource validator, i.e. through
whichever constraint implementation the runtime configures. Syntax or linking errors fail the fixture: keep them
syntactically and referentially clean, violate only the constraint under test.
Run: `mvn verify -Dtest=ConstraintSuiteTest -DfailIfNoTests=false` from `org.etsi.mts.tdl.parent` (whole reactor).
The coverage report (`target/constraints-coverage.md`) lists every constraint of the standard with the number of
fixtures that expect it and the OCL operations of its expression; aim for one fixture per branch of the expression
(each `if`, `forAll`/`exists` with empty and non-empty collections, `oclIsKindOf` alternatives).
Naming: `<Context>_<Name>[.<variant>].tdltx`, grouped by document (`core`, `structured`, `configurations`).