Commit 4163402d authored by Martti Käärik's avatar Martti Käärik
Browse files

AlternativeBehaviourParticipation and ExceptionalBehaviourParticipation...

AlternativeBehaviourParticipation and ExceptionalBehaviourParticipation participation constraints rely on getParticipatingComponents()
parent 22e3d143
Loading
Loading
Loading
Loading
Loading
+2 −16
Changes for plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl: 2 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -822,15 +822,8 @@ context AlternativeBehaviour

  -- 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 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
        self.getPermittedComponents()->includesAll(
              nonOptionalBlocks.behaviour->reject(oclIsKindOf(OptionalBehaviour)).getParticipatingComponents()->reject(c | c.role = ComponentInstanceRole::SUT))
              self.block.getParticipatingComponents()->reject(c | c.role = ComponentInstanceRole::SUT))
          or not self.getParentTestDescription().isLocallyOrdered
  

@@ -890,15 +883,8 @@ context ExceptionalBehaviour

  -- 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 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
        self.getPermittedComponents()->includesAll(
              nonOptionalBlocks.behaviour->reject(oclIsKindOf(OptionalBehaviour)).getParticipatingComponents()->reject(c | c.role = ComponentInstanceRole::SUT))
              self.block.getParticipatingComponents()->reject(c | c.role = ComponentInstanceRole::SUT))
          or not self.getParentTestDescription().isLocallyOrdered
  

+38 −0
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/AlternativeBehaviour_AlternativeBehaviourParticipation.nestedOptional.tdltx: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
//! expect none
// The optional behaviour sits one level deeper, inside a compound behaviour. It starts on the
// permitted tester, and its target tester2 is triggered explicitly, so tester2 does not take part
// in the alternative. The participants of the compound behaviour must not bring it back in.
Package AlternativeBehaviourParticipationNestedOptional {
    Import all from TDL

    Type Msg
    Msg m1

    Message Gate mGate accepts Msg

    Component Node {
        gate mGate g
    }

    Configuration cfg {
        Node tester1 as Tester,
        Node tester2 as Tester,
        Node sut as SUT,
        connect tester1::g to sut::g,
        connect tester2::g to sut::g,
        connect tester1::g to tester2::g
    }

    Test td uses cfg {
        alternatively {
            sut::g sends m1 to tester1::g
            {
                optionally {
                    tester1::g sends m1 to tester2::g
                }
            }
        } or {
            sut::g sends m1 to tester1::g
        }
    }
}
+41 −0
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/ExceptionalBehaviour_ExceptionalBehaviourParticipation.nestedOptional.tdltx: 41 added lines, 0 removed lines.
Original line number Diff line number Diff line
//! expect none
// The optional behaviour sits one level deeper, inside a compound behaviour. It starts on the
// permitted tester, and its target tester2 is triggered explicitly, so tester2 does not take part
// in the default. The participants of the compound behaviour must not bring it back in.
Package ExceptionalBehaviourParticipationNestedOptional {
    Import all from TDL

    Type Msg
    Msg m1

    Message Gate mGate accepts Msg

    Component Node {
        gate mGate g
    }

    Configuration cfg {
        Node tester1 as Tester,
        Node tester2 as Tester,
        Node sut as SUT,
        connect tester1::g to sut::g,
        connect tester2::g to sut::g,
        connect tester1::g to tester2::g
    }

    Test td uses cfg {
        while {
            sut::g sends m1 to tester1::g
        }
        with {
            default {
                sut::g sends m1 to tester1::g
                {
                    optionally {
                        tester1::g sends m1 to tester2::g
                    }
                }
            }
        }
    }
}
+3 −0
Changes for plugins/org.etsi.mts.tdl.tx.tests/src/constraints/core/ExceptionalBehaviour_OptionalExceptionalBehaviour.tdltx: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
//! expect ExceptionalBehaviour::OptionalExceptionalBehaviour
//! allow ExceptionalBehaviour::ExceptionalBehaviourParticipation
// The participation constraint reports the same mistake: an optional takes part in its container
// through the source of its starting interaction, and tester2 is not permitted here.
// Locally ordered: only tester1 is permitted (target of the first tester-input event of the
// block), but the optional behaviour inside the default starts on tester2. The optional's first
// interaction is tester-to-tester, as OptionalBehaviourStart requires.