Commit 778c170c authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* aligned and updated constraints, #208

parent 5d8d3d22
Loading
Loading
Loading
Loading
+47 −70
Original line number Diff line number Diff line
@@ -185,17 +185,18 @@ context SimpleDataInstance

  -- Type of the 'value' shall conform to the type of the 'SimpleDataInstance'
  inv MatchingValueDataType ('The \'DataType\' of the \'DataUse\' of \'value\' shall conform to the \'DataType\' of the \'SimpleDataInstance\'.' + self.toString()):
        self.value.resolveDataType().conformsTo(self.dataType)
        self.value.oclIsUndefined() or self.value.resolveDataType().conformsTo(self.dataType)
  

  -- No 'OmitValue' for 'SimpleDataInstance'
  inv OmitValueSimpleDataInstance ('A \'value\' of a \'SimpleDataInstance\' shall have a \'DataUse\' specification assigned to it that is different from \'OmitValue\' and \'AnyValueOrOmit\'.' + self.toString()):
        not (self.value.oclIsTypeOf(OmitValue) or self.value.oclIsTypeOf(AnyValueOrOmit))
        self.value.oclIsUndefined() or 
          (not (self.value.oclIsTypeOf(OmitValue) or self.value.oclIsTypeOf(AnyValueOrOmit)))
  

  -- Static data use in 'value' 
  inv StaticDataInValue ('The \'value\' shall be effectively static. ' + self.toString()):
        self.value.isEffectivelyStatic()
        self.value.oclIsUndefined() or self.value.isEffectivelyStatic()
  

  -- [Figure 6.3: Structured data type and instance]
@@ -294,15 +295,15 @@ context CollectionDataInstance
  -- [Figure 6.5: Procedure and procedure parameter]


context FormalParameter
  -- Type of the 'value' shall conform to the type of the 'FormalParameter'
  inv MatchingValueDataTypeFormalParameter ('The \'DataType\' of the \'DataUse\' of \'value\' shall conform to the \'DataType\' of the \'SimpleDataInstance\'.' + self.toString()):
        self.value.resolveDataType().conformsTo(self.dataType)
context Parameter
  -- Type of the 'value' shall conform to the type of the 'Parameter'
  inv MatchingValueDataTypeParameter ('The \'DataType\' of the \'DataUse\' of \'value\' shall conform to the \'DataType\' of the \'Parameter\'.' + self.toString()):
        self.value.oclIsUndefined() or self.value.resolveDataType().conformsTo(self.dataType)
  

  -- Static data use in 'FormalParameter' 'value' 
  inv StaticDataInFormalParameterValue ('The \'value\' shall be effectively static. ' + self.toString()):
        self.value.isEffectivelyStatic()
  -- Static data use in 'Parameter' 'value' 
  inv StaticDataInParameterValue ('The \'value\' shall be effectively static. ' + self.toString()):
        self.value.oclIsUndefined() or self.value.isEffectivelyStatic()
  


@@ -313,6 +314,11 @@ context EnumDataType
        self.extension.oclIsUndefined()
  

  -- No 'value' for contained 'SimpleDataInstance's 
  inv NoValueInEnumInstance ('There shall be \'value\'s for \'SimpleDataInstance\'s contained in \'EnumDataType\'. ' + self.toString()):
        self.value->forAll(i | i.value.oclIsUndefined())
  



context DataUse
@@ -425,8 +431,9 @@ context SpecialValueUse

context FunctionCall
  -- Matching parameters
  inv FunctionCallParameters ('All \'FormalParameter\'s of the invoked \'Function\' shall be bound.' + self.toString()):
        self.function.formalParameter->forAll(p | self.argument->exists(a | a.parameter = p))
  inv FunctionCallParameters ('All \'FormalParameter\'s of the invoked \'Function\' that do not have default \'value\'s shall be bound.' + self.toString()):
        self.function.formalParameter->select(p | p.value.oclIsUndefined())
              ->forAll(p | self.argument->exists(a | a.parameter = p))
  


@@ -516,9 +523,11 @@ context DataElementUse
  

  -- Matching parameters for 'Function's
  inv FunctionCallParameters ('All \'FormalParameter\'s shall be bound if the \'dataElement\' refers to a \'Function\'.' + self.toString()):
  inv FunctionCallParameters ('All \'FormalParameter\'s that do not have a default \'value shall be bound if the \'dataElement\' refers to a \'Function\'.' + self.toString()):
        not self.dataElement.oclIsTypeOf(Function)
      or self.dataElement.oclAsType(Function).formalParameter->forAll(p | self.argument->exists(a | a.parameter = p))
      or self.dataElement.oclAsType(Function).formalParameter
          ->select(p | p.value.oclIsUndefined())
          ->forAll(p | self.argument->exists(a | a.parameter = p))
  


@@ -823,48 +832,31 @@ context AlternativeBehaviour

  -- Same component if locally ordered
  inv AlternativeBlocksComponent ('If the containing \'TestDescription\' is locally ordered then all \'Block\'s shall start with a tester-input event of the same \'ComponentInstance\'. ' + self.toString()):
        let initial = self.block.behaviour->first() in
          Set{}
          ->includingAll(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction)
                  .target.targetGate.component)
          ->includingAll(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).effectiveComponent())
          -> includingAll(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).effectiveComponent())
          ->size() = 1 or not self.getParentTestDescription().isLocallyOrdered
        not self.getParentTestDescription().isLocallyOrdered or self.getPermittedComponents()->size() = 1
  

  -- Tester participating in locally ordered case
  inv AlternativeBehaviourParticipation ('If the \'AlternativeBehaviour\' is contained in a locally ordered \'TestDescription\' then no other tester \'ComponentInstance\' shall participate in any block than the target of the first tester-input event and \'ComponentInstance\'s participating in blocks of contained \'OptionalBehaviour\'s. ' + self.toString()):
        let initial = self.block.behaviour->first(),
          targetComponent = Set{}
          ->includingAll(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction)
                  .target.targetGate.component)
          ->includingAll(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).effectiveComponent())
          -> includingAll(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).effectiveComponent()),
          nonOptionalBlocks = self.block->closure(
        let nonOptionalBlocks = self.block->closure(
              b | b.behaviour->reject(oclIsKindOf(OptionalBehaviour))
                  ->select(oclIsKindOf(SingleCombinedBehaviour)).oclAsType(SingleCombinedBehaviour).block
              ->union(b.behaviour->reject(oclIsKindOf(OptionalBehaviour))
                  ->select(oclIsKindOf(MultipleCombinedBehaviour)).oclAsType(MultipleCombinedBehaviour).block)
          )
          in
          targetComponent->includesAll(
          self.getPermittedComponents()->includesAll(
              nonOptionalBlocks.getParticipatingComponents()->reject(c | c.role = ComponentInstanceRole::SUT))
          or not self.getParentTestDescription().isLocallyOrdered
  

  -- OptionalBehaviour in locally ordered case
  inv OptionalAlternativeBehaviour ('A block of an \'AlternativeBehaviour\' if the containing \'TestDescription\' is locally ordered, shall only contain \'OptionalBehaviour\'(s) whose source \'ComponentInstance\' is the same as the target of the first tester-input event of that \'Block\'. ' + self.toString()):
        let initial = self.block.behaviour->first(),
          targetComponent = Set{}
          ->includingAll(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction)
                 .target.targetGate.component)
          ->includingAll(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).effectiveComponent())
          -> includingAll(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).effectiveComponent())
          in
          self.block.behaviour->select(oclIsKindOf(OptionalBehaviour))->isEmpty()
          or 
          self.block.behaviour->select(oclIsKindOf(OptionalBehaviour)) .oclAsType(OptionalBehaviour).block.behaviour 
              ->first().oclAsType(Interaction).sourceGate.component->forAll(c | targetComponent->includes(c))
          self.block.behaviour
              ->select(oclIsKindOf(OptionalBehaviour)).oclAsType(OptionalBehaviour).block.behaviour
              ->first().oclAsType(Interaction).sourceGate.component
              ->forAll(c | self.getPermittedComponents()->includes(c))
          or not self.getParentTestDescription().isLocallyOrdered
  

@@ -906,49 +898,30 @@ context ExceptionalBehaviour

  -- Same component if locally ordered and guarded component present
  inv ExceptionalGuardedandTargetComponent ('If the containing \'TestDescription\' is locally ordered and guardedComponent is specified then the \'Block\'s shall start with tester-input event of the same \'ComponentInstance\' as specified in guardedComponent. ' + self.toString()):
        let initial = self.block.behaviour->first(),
          targetComponent = Set{}
          ->includingAll(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction)
                  .target.targetGate.component)
          ->includingAll(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).effectiveComponent())
          -> includingAll(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).effectiveComponent())
          in
          guardedComponent->includesAll(targetComponent)
          guardedComponent->includesAll(self.getPermittedComponents())
          or not self.getParentTestDescription().isLocallyOrdered
  

  -- Tester participating in locally ordered case
  inv ExceptionalBehaviourParticipation ('If the \'ExceptionalBehaviour\' is contained in a locally ordered \'TestDescription\' then no other tester \'ComponentInstance\' shall participate in any block than the target of the first tester-input event and \'ComponentInstance\'s participating in blocks of contained \'OptionalBehaviour\'s . ' + self.toString()):
        let initial = self.block.behaviour->first(),
          targetComponent = Set{}
          ->includingAll(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction)
                  .target.targetGate.component)
          ->includingAll(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).effectiveComponent())
          ->includingAll(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).componentInstance),
          nonOptionalBlocks = self.block->closure(
        let nonOptionalBlocks = self.block->closure(
              b | b.behaviour->reject(oclIsKindOf(OptionalBehaviour))
                  ->select(oclIsKindOf(SingleCombinedBehaviour)).oclAsType(SingleCombinedBehaviour).block
              ->union(b.behaviour->reject(oclIsKindOf(OptionalBehaviour))
                  ->select(oclIsKindOf(MultipleCombinedBehaviour)).oclAsType(MultipleCombinedBehaviour).block)
          )
          in
          targetComponent->includesAll(
          self.getPermittedComponents()->includesAll(
              nonOptionalBlocks.getParticipatingComponents()->reject(c | c.role = ComponentInstanceRole::SUT))
          or not self.getParentTestDescription().isLocallyOrdered
  

  -- OptionalBehaviour in locally ordered case
  inv OptionalExceptionalBehaviour ('A block of an \'ExceptionalBehaviour\' if the containing \'TestDescription\' is locally ordered, shall only contain \'OptionalBehaviour\'(s) whose source \'ComponentInstance\' is the same as the target of the first tester-input event of that \'Block\'. ' + self.toString()):
        let initial = self.block.behaviour->first(),
          targetComponent = Set{}
          ->includingAll(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction)
                  .target.targetGate.component)
          ->includingAll(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).effectiveComponent())
          -> includingAll(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).effectiveComponent())
          in
          self.block.behaviour->select(oclIsKindOf(OptionalBehaviour))
              .oclAsType(OptionalBehaviour)->forAll(op | op.block.behaviour->asSequence()
              ->first().oclAsType(Interaction).sourceGate.component->forAll(c | targetComponent->includes(c)))
              ->first().oclAsType(Interaction).sourceGate.component
              ->forAll(c | self.getPermittedComponents()->includes(c)))
          or not self.getParentTestDescription().isLocallyOrdered
  

@@ -1135,10 +1108,12 @@ context ProcedureCall
  

  -- Matching procedure arguments
  inv ProcedureCallArguments ('For a \'ProcedureCall\' with empty \'replyTo\' there shall be one \'ParameterBinding\' instance in the \'argument\' for each \'ProcedureParameter\' with kind \'In\' in the associated \'ProcedureSignature\'. For a \'ProcedureCall\' with \'replyTo\' there shall be one \'ParameterBinding\' instance in the \'argument\' for each \'ProcedureParameter\' with kind \'Out\' or \'Exception\' in the associated \'ProcedureSignature\'. ' + self.toString()):
        (self.replyTo.oclIsUndefined() and self.signature.parameter->select(p | p.kind = ParameterKind::In)
  inv ProcedureCallArguments ('For a \'ProcedureCall\' with empty \'replyTo\' there shall be one \'ParameterBinding\' instance in the \'argument\' for each \'ProcedureParameter\' with kind \'In\' that has no default \'value\' in the associated \'ProcedureSignature\'. For a \'ProcedureCall\' with \'replyTo\' there shall be one \'ParameterBinding\' instance in the \'argument\' for each \'ProcedureParameter\' with kind \'Out\' or \'Exception\' that has no default \'value\' in the associated \'ProcedureSignature\'. ' + self.toString()):
        (self.replyTo.oclIsUndefined() and self.signature.parameter
              ->select(p | p.kind = ParameterKind::In and p.value.oclIsUndefined())
              ->forAll(p | self.argument.parameter->includes(p)))
          or (not self.replyTo.oclIsUndefined() and self.signature.parameter->reject(p | p.kind = ParameterKind::In)
          or (not self.replyTo.oclIsUndefined() and self.signature.parameter
              ->reject(p | p.kind = ParameterKind::In and not p.value.oclIsUndefined())
              ->forAll(p | self.argument.parameter->includes(p)))
  

@@ -1190,8 +1165,9 @@ context ValueAssignment

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))
  inv AllTestDescriptionParametersBound ('For each \'FormalParameter\' defined in \'formalParameter of\' the referenced \'TestDescription\' that does not have a default \'value\', there shall be a \'ParameterBinding\' in \'argument\' that refers to that \'FormalParameter\' in \'parameter\'.' + self.toString()):
          self.testDescription.formalParameter->select(p | p.value.oclIsUndefined())
              ->forAll(p | self.argument->exists(a | a.parameter = p))
  

  -- No use of variables in arguments
@@ -1263,8 +1239,9 @@ context ActionBehaviour

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))
  inv AllActionParametersBound ('For each \'FormalParameter\' defined in \'formalParameter of\' the referenced \'Action\' that does not have a default \'value\', there shall be a \'ParameterBinding\' in \'argument\' that refers to that \'FormalParameter\' in \'parameter\'. ' + self.toString()):
        self.action.formalParameter->select(p | p.value.oclIsUndefined())
              ->forAll(p | self.argument.parameter->includes(p))
  

  -- No 'Function's in 'ActionReference'