Commit 551cff36 authored by Martti Käärik's avatar Martti Käärik
Browse files

Constraints without allInstances(), re-exported from the specification

parent fad9b9f7
Loading
Loading
Loading
Loading
Loading
+13 −9
Changes for plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl: 13 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -29,7 +29,9 @@ context NamedElement

  -- Distinguishable qualified names
  inv DistinguishableName ('All qualified names of instances of \'NamedElement\'s shall be distinguishable within a TDL model.' + self.toString()):
        NamedElement.allInstances()->one(e | e.qualifiedName = self.qualifiedName)
        self.oclAsType(Element)->closure(e | e.oclContents()->reject(c | c.oclIsKindOf(NamedElement)))
              ->collect(e | e.oclContents())->select(oclIsKindOf(NamedElement)).oclAsType(NamedElement) 
              ->isUnique(e | e.qualifiedName)
  

  -- [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.]
@@ -392,7 +394,7 @@ context ParameterBinding
context MemberReference
  -- Either member or collection index is required
  inv MemberOrIndex ('Either the member or collectionIndex shall be specified, but not both. ' + self.toString()):
        self.member.oclIsUndefined() <> self.collectionIndex.oclIsUndefined()
        self.member.oclIsUndefined() xor self.collectionIndex.oclIsUndefined()
  


@@ -1047,7 +1049,10 @@ context ProcedureCall

  -- Each call has a reply
  inv ProcedureCallHasReply ('For every \'ProcedureCall\' with empty \'replyTo\' there shall be one or more \'ProcedureCall\'s that have this \'ProcedureCall\' as \'replyTo\'. ' + self.toString()):
        self.replyTo.oclIsUndefined() implies ProcedureCall.allInstances()->exists(pc | pc.replyTo = self)
        self.replyTo.oclIsUndefined() implies
              self.getParentTestDescription().oclAsType(Element)->closure(e | e.oclContents())
                  ->select(oclIsKindOf(ProcedureCall)).oclAsType(ProcedureCall) 
                  ->exists(pc | pc.replyTo = self)
  

  -- Call and reply within the same 'TestDescription'
@@ -1058,12 +1063,11 @@ context ProcedureCall

  -- Call and reply between same components
  inv ProcedureCallReplyGates ('The \'sourceGate\' and \'target\' of a \'ProcedureCall\' with \'replyTo\' shall match the \'target\' and \'sourceGate\' of the \'ProcedureCall\' in the \'replyTo\'. That is, corresponding \'GateReference\'s shall be the equal. ' + self.toString()):
        ProcedureCall.allInstances()->select(pc | pc.replyTo = self)->forAll(
      reply |
      reply.target->forAll(t | t.targetGate.component = self.sourceGate.component)
      and reply.target->forAll(t | t.targetGate.gate = self.sourceGate.gate)
      and self.target->forAll(t | t.targetGate.component = reply.sourceGate.component)
      and self.target->forAll(t | t.targetGate.gate  = reply.sourceGate.gate))
        self.replyTo.oclIsUndefined() or 
      (self.replyTo.target->forAll(t | t.targetGate.component = self.sourceGate.component)
      and self.replyTo.target->forAll(t | t.targetGate.gate = self.sourceGate.gate)
      and self.target->forAll(t | t.targetGate.component = self.replyTo.sourceGate.component)
      and self.target->forAll(t | t.targetGate.gate  = self.replyTo.sourceGate.gate))
  

  -- Synchronous procedure calls
+3 −2
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/NamedElement_DistinguishableName.tdltx: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
//! expect NamedElement::DistinguishableName x2
// Two types with the same qualified name in one package: both instances are reported.
//! expect NamedElement::DistinguishableName x1
// Two types with the same qualified name in one package. The constraint is evaluated on the owner of
// the names, so it is reported once, on the package, like the other uniqueness constraints.
Package DistinguishableName {
    Import all from TDL
    Type Dup
+3 −0
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/ProcedureCall_ProcedureCallAndReply.tdltx: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
//! expect ProcedureCall::ProcedureCallAndReply
//! allow ProcedureCall::ProcedureCallHasReply
// The reply is in a different test description than the call it replies to.
// The call then has no reply in its own test description, which is where ProcedureCallHasReply
// looks for one, so that constraint fires as well; the two violations cannot be separated.
Package PcAndReply {
    Type Pdu
    Pdu pdu1