Skip to content
tdl-constraints.ocl 64.6 KiB
Newer Older
Philip Makedonski's avatar
Philip Makedonski committed
        (self.replyTo.oclIsUndefined() and self.signature.parameter->select(p | p.kind = ParameterKind::In)
              ->forAll(p | self.argument.parameter->includes(p)))
          or (not self.replyTo.oclIsUndefined() and self.signature.parameter->reject(p | p.kind = ParameterKind::In)
              ->forAll(p | self.argument.parameter->includes(p)))
  

  -- Use of variables in the 'argument' specification
  inv ProcedureCallVariableUse ('The use of \'Variable\'s in the \'DataUse\' specifications in \'ParameterBinding\'s shall be restricted to \'Variable\'s of \'ComponentInstance\'s that participate in this \'ProcedureCall\' via the provided \'GateReference\'s. ' + self.toString()):
        self.argument
              ->closure(pb | pb.dataUse.argument)->union(self.argument)->collect(pb | pb.dataUse)
              ->select(du | du.oclIsKindOf(VariableUse))
              ->forAll(du | self.getParticipatingComponents()->includes(
                  du.oclAsType(VariableUse).componentInstance))
  

  -- Reply not starting event of exceptional behaviour
  inv ProcedureCallReplyNotInExceptional ('A \'ProcedureCall\' that specifies replyTo shall not be the first behaviour of a block in an \'ExceptionalBehaviour\'. ' + self.toString()):
        self.replyTo.oclIsUndefined() or not self.container().container().oclIsKindOf(ExceptionalBehaviour)
  



context Target
  -- Variable and target gate of the same component instance
  inv TargetComponent ('The \'Variable\'s referenced by \'valueAssignment\' shall exist in the same \'ComponentType\' as the \'GateInstance\' that is referred to by the \'GateReference\' of the \'targetGate\'.' + self.toString()):
        self.valueAssignment->isEmpty()
      or self.targetGate.component.type.allVariables()->includesAll(self.valueAssignment.variable)
  

  -- Variable of a tester component only
  inv TargetVariableComponentRole ('If a \'ValueAssignment\' is specified, the \'ComponentInstance\' referenced by \'targetGate\' shall be in the role \'Tester\'.' + self.toString()):
        self.valueAssignment->isEmpty () or self.targetGate.component.role = ComponentInstanceRole::Tester
  



context ValueAssignment
  -- Conforming data type for 'parameter' and 'variable'
  inv AssignedParamterType ('If the \'parameter\' is specified then its type shall conform to the type of the \'variable\'. ' + self.toString()):
        self.parameter.oclIsUndefined() or self.parameter.dataType.conformsTo(self.variable.dataType)
  

  -- Parameter of associated procedure signature
  inv AssignedProcedureParameter ('If the \'parameter\' is specified then it shall be contained in the \'ProcedureSignature\' that is referred in the \'signature\' ot the \'ProcedureCall\' containing this \'ValueAssignment\'.' + self.toString()):
        self.parameter.oclIsUndefined()
      or (self.container().container().oclIsKindOf(ProcedureCall) and
      self.container().container().oclAsType(ProcedureCall).signature.parameter->includes(self.parameter))
  

  -- [Figure 9.6: Test description reference]


context TestDescriptionReference
  -- All test description parameters bound 
  inv AllTestDescriptionParametersBound ('For each \'FormalParameter\' defined in \'formalParameter of\' the referenced \'TestDescription\' there shall be a \'ParameterBinding\' in \'argument\' that refers to that \'FormalParameter\' in \'parameter\'.' + self.toString()):
          self.testDescription.formalParameter->forAll(p | self.argument->exists(a | a.parameter = p))
  

  -- No use of variables in arguments
  inv NoVariablesInLocallyOrderedTestDescriptionReference ('In locally ordered \'TestDescription\'s, \'DataUse\' expressions used to describe arguments shall not contain variables directly or indirectly in \'TestDescriptionReference\'s.' + self.toString()):
        self.argument. dataUse->forAll(du |
              not du.oclIsKindOf(VariableUse)
          and du.argument->forAll(a | not a.dataUse.oclIsKindOf(VariableUse))
          and du.argument->closure(a | a.dataUse.argument)->forAll(a |
                  not a.dataUse.oclIsKindOf(VariableUse)))
  

  -- No use of time labels in arguments
  inv NoTimeLabelsInLocallyOrderedTestDescriptionReference ('In locally ordered \'TestDescription\'s, \'DataUse\' expressions used to describe arguments shall not contain time labels directly or indirectly in \'TestDescriptionReference\'s.' + self.toString()):
        self.argument.dataUse->forAll(du |
              not du.oclIsKindOf(TimeLabelUse)
          and du.argument->forAll(a | not a.dataUse.oclIsKindOf(TimeLabelUse))
          and du.argument->closure(a | a.dataUse.argument)->forAll(a |
                  not a.dataUse.oclIsKindOf(TimeLabelUse)))
  

  -- Restriction to 1:1 component instance bindings
  inv UniqueComponentBindings ('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.' + self.toString()):
        self.componentInstanceBinding->isEmpty()
      or self.componentInstanceBinding->forAll(b |
              self.componentInstanceBinding->one(c |
                  c.formalComponent = b.formalComponent or c.actualComponent = b.actualComponent))
  

  -- Compatible test configurations 
  inv CompatibleConfiguration ('The \'TestConfiguration\' of the referenced (invoked) \'TestDescription\' shall be compatible with the \'TestConfiguration\' of the referencing (invoking) \'TestDescription\' under the provided \'ComponentInstanceBinding\'s between the \'ComponentInstance\'s of the \'TestConfiguration\'s of referenced and referencing \'TestDescription\'s. ' + self.toString()):
        self.testDescription.testConfiguration.compatibleWith(
              self.getParentTestDescription().testConfiguration, self.componentInstanceBinding)
  

  -- No combining of local and total ordering 
  inv LocalAndTotalOrdering ('The referenced \'TestDescription\' shall have the same ordering assumption as the referencing \'TestDescription\'.' + self.toString()):
        self.getParentTestDescription().isLocallyOrdered = self.testDescription.isLocallyOrdered
  



context ComponentInstanceBinding
  -- Conforming component types
  inv BindingComponentTypes ('The \'ComponentType\' of the actual \'ComponentInstance\' shall conform to \'ComponentType\' of the formal \'ComponentInstance.' + self.toString()):
        self.actualComponent.type.conformsTo(self.formalComponent.type)
  

  -- Matching component instance roles
  inv BindingComponentRoles ('Both, the formal and the actual component instances, shall have the same \'ComponentInstanceRole\' assigned to.' + self.toString()):
        self.formalComponent.role = self.actualComponent.role
  

  -- [Figure 9.7: Action behaviour concepts]


context ActionBehaviour
  -- 'ActionBehaviour' on 'Tester' components only
  inv ActionBehaviourComponentRole ('The \'ComponentInstance\' that an \'ActionBehaviour\' refers to shall be of role \'Tester\'.' + self.toString()):
        self.componentInstance.oclIsUndefined() or self.componentInstance.role = ComponentInstanceRole::Tester
  

  -- Known 'componentInstance' with locally-ordered behaviour 
  inv ActionBehaviourComponentInstance ('The \'ComponentInstance\' that an \'ActionBehaviour\' refers to shall be specified if the \'ActionBehaviour\' is used within a locally-ordered \'TestDescription\'.' + self.toString()):
        not self.componentInstance.oclIsUndefined() or not self.getParentTestDescription().isLocallyOrdered
  



context ActionReference
  -- All action parameters bound 
  inv AllActionParametersBound ('For each \'FormalParameter\' defined in \'formalParameter of\' the referenced \'Action\' there shall be a \'ParameterBinding\' in \'argument\' that refers to that \'FormalParameter\' in \'parameter\'. ' + self.toString()):
        self.action.formalParameter->forAll(p | self.argument.parameter->includes(p))
  

  -- No 'Function's in 'ActionReference' 
  inv ActionReferenceFunction ('The referenced \'Action\' shall not be a \'Function\'.' + self.toString()):
        not self.action.oclIsTypeOf(Function)
  



context Assignment
  -- Conforming data type
  inv AssignmentDataType ('The provided \'DataUse\' expression shall conform to the \'DataType\' of the referenced \'Variable\'.' + self.toString()):
        self.expression.resolveDataType().conformsTo(self.variable.variable.dataType)
  

  -- Empty 'argument' set for 'variable'
  inv AssignmentVariableArgument ('The \'argument\' and \'reduction\' sets shall be empty.' + self.toString()):
        self.variable.argument->isEmpty()
  




endpackage