From 900da81f5d8b578712c68e358fa75b5e14ed034b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martti=20K=C3=A4=C3=A4rik?= <martti.kaarik@elvior.com> Date: Wed, 8 Nov 2023 18:40:50 +0200 Subject: [PATCH] Corrected AlternativeBehaviour constraints. --- .../model/tdl-constraints.ocl | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl b/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl index dd518304..246dc688 100644 --- a/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl +++ b/plugins/org.etsi.mts.tdl.model/model/tdl-constraints.ocl @@ -695,49 +695,54 @@ context AlternativeBehaviour -- First behaviour of 'Block's inv FirstBlockBehaviour ('Each block of an \'AlternativeBehaviour\' shall start with a tester-input event. ' + self.toString()): - self.block->forAll(b | b.behaviour->first().isTesterInputEvent()) + self.block->forAll(b | b.behaviour->isEmpty() or b.behaviour->first().isTesterInputEvent()) -- 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 + let initials = self.block->reject(b | b.behaviour->first()->isEmpty() or b.behaviour->first().oclIsKindOf(OptionalBehaviour)).behaviour->first() + in Set{} - ->including(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction).target.targetGate.component) - ->including(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).componentInstance) - -> including(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).componentInstance) + ->union(initials->select(oclIsKindOf(Interaction)).oclAsType(Interaction).target.targetGate.component) + ->union(initials->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).componentInstance) + ->union(initials->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).componentInstance) ->size() = 1 or not self.getParentTestDescription().isLocallyOrdered -- 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(), + let initials = self.block->reject(b | b.behaviour->first()->isEmpty() or b.behaviour->first().oclIsKindOf(OptionalBehaviour)).behaviour->first(), targetComponent = Set{} - ->including(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction).target.targetGate.component) - ->including(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).componentInstance) - -> including(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).componentInstance), + ->union(initials->select(oclIsKindOf(Interaction)).oclAsType(Interaction).target.targetGate.component) + ->union(initials->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).componentInstance) + -> union(initials->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).componentInstance), nonOptionalBlocks = self.block->closure( b | b.behaviour->reject(oclIsKindOf(OptionalBehaviour)) ->select(oclIsKindOf(SingleCombinedBehaviour)).oclAsType(SingleCombinedBehaviour).block - ->union(b.behaviour->reject(oclIsKindOf(OptionalBehaviour)) + ->union(b.behaviour ->select(oclIsKindOf(MultipleCombinedBehaviour)).oclAsType(MultipleCombinedBehaviour).block) ) in - targetComponent->includesAll( + targetComponent->includesAll( nonOptionalBlocks.getParticipatingComponents()->reject(c | c.role = ComponentInstanceRole::SUT)) - or not self.getParentTestDescription().isLocallyOrdered + 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(), + let initials = self.block->reject(b | b.behaviour->first()->isEmpty() or b.behaviour->first().oclIsKindOf(OptionalBehaviour)).behaviour->first(), targetComponent = Set{} - ->including(initial->select(oclIsKindOf(Interaction)).oclAsType(Interaction).target.targetGate.component) - ->including(initial->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).componentInstance) - -> including(initial->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).componentInstance) + ->union(initials->select(oclIsKindOf(Interaction)).oclAsType(Interaction).target.targetGate.component) + ->union(initials->select(oclIsKindOf(Quiescence)).oclAsType(Quiescence).componentInstance) + -> union(initials->select(oclIsKindOf(TimeOut)).oclAsType(TimeOut).componentInstance), + optionalBlocks = self.block->closure( + b | b.behaviour->select(oclIsKindOf(SingleCombinedBehaviour)).oclAsType(SingleCombinedBehaviour).block + ->union(b.behaviour->select(oclIsKindOf(MultipleCombinedBehaviour)).oclAsType(MultipleCombinedBehaviour).block) + )->select(oclIsKindOf(OptionalBehaviour)) in - self.block.behaviour->select(oclIsKindOf(OptionalBehaviour)) .oclAsType(OptionalBehaviour).block - ->first().oclAsType(Interaction).sourceGate.component->forAll(c | targetComponent->includes(c)) - or not self.getParentTestDescription().isLocallyOrdered + optionalBlocks->isEmpty() + or optionalBlocks->first().oclAsType(Interaction).sourceGate.component->forAll(c | targetComponent->includes(c)) + or not self.getParentTestDescription().isLocallyOrdered -- GitLab