Loading plugins/org.etsi.mts.tdl.constraints/epsilon/library/common.eol +74 −0 Original line number Diff line number Diff line Loading @@ -11,11 +11,19 @@ operation Any oclIsKindOf(t:Any) : Boolean { return self.isKindOf(t); } operation Any oclType() : Any { return self.type(); } operation Any oclAsType(t:Any) : Any { return self; } //TODO: does not seem to work operation Any union(other:Any) : Collection { return self.includingAll(other); } operation Any notEmpty() : Boolean { return not self.isEmpty(); } Loading @@ -29,6 +37,11 @@ operation String size() : Integer { return self.length(); } //TODO: is it possible to define custom predicated operations? //operation Collection isUnique() : Boolean { // return not self.isEmpty(); //} //Supporting operations operation Any getTestDescription() : Any { Loading Loading @@ -171,6 +184,7 @@ operation TDL!SpecialValueUse getDataType() : Any { } //Check if Behaviour is tester input event //TODO: this should be handled already in Ecore/OCL -> rename and test, then remove! operation TDL!Behaviour isTesterInputEvent() : Boolean { return self.oclIsKindOf(TimeOut) or self.oclIsKindOf(Quiescence) Loading @@ -179,3 +193,63 @@ operation TDL!Behaviour isTesterInputEvent() : Boolean { and self.target->exists(t | t.targetGate.component.role.name = 'Tester')); } //TODO: migrate to tdl.ecore? operation TDL!TestConfiguration compatibleWith(tc:TDL!TestConfiguration, cb:Set) : Boolean { //TODO:copy and adapt from previous draft, add connections //self: configuration of invoked test description / TConf2 //tc: configuration of invoking test description / TConf1 //formalComponent: component in invoked test description //actualComponent: component in invoking test description if ( //same test configuration shortcut? bindings necessary //(self = tc and cb->isEmpty()) or //valid bindings exist (validity deferred to binding constraints) (self.componentInstance->forAll(c | cb.exists(b | b.formalComponent = c)) and self.connection->forAll(c | c.hasMatchingConnection(tc, cb)) ) ) { return true; } return false; } //helper //TODO: move to tdl.ecore in case as well //TODO: assumes binding exists, handle same? operation TDL!ComponentInstance getActualComponent(cb: Set) : TDL!ComponentInstance { return cb->select(b | b.formalComponent = self)->first().actualComponent; } //helper //TODO: move to tdl.ecore in case as well? //TODO: assumes binding exists, handle same? //operation TDL!GateInstance getActualGate(cb: Set) : TDL!GateInstance { // return cb->select(b | b.formalComponent = self)->first().actualComponent; //} //helper - get candidate matching connections with corresponding components //TODO: move to tdl.ecore in case as well? operation TDL!Connection getMatchingConnections(tc: TDL!TestConfiguration, cb: Set) : Set { return tc.connection->select(p | (p.endPoint->at(0).component = self.endPoint->at(0).component.getActualComponent(cb) and p.endPoint->at(1).component = self.endPoint->at(1).component.getActualComponent(cb)) or (p.endPoint->at(1).component = self.endPoint->at(0).component.getActualComponent(cb) and p.endPoint->at(0).component = self.endPoint->at(1).component.getActualComponent(cb)) ); } //helper - get matching connections with corresponding components operation Set perfectMatchExists(c:TDL!Connection) : Boolean { return self->exists(m | (m.endPoint->at(0).gate.type = c.endPoint->at(0).gate.type and m.endPoint->at(1).gate.type = c.endPoint->at(1).gate.type) or (m.endPoint->at(0).gate.type = c.endPoint->at(1).gate.type and m.endPoint->at(1).gate.type = c.endPoint->at(0).gate.type) ); } //helper - get check if there is perfect matching connection operation TDL!Connection hasMatchingConnection(tc: TDL!TestConfiguration, cb: Set) : Boolean { return self.getMatchingConnections(tc, cb).perfectMatchExists(self); } Loading
plugins/org.etsi.mts.tdl.constraints/epsilon/library/common.eol +74 −0 Original line number Diff line number Diff line Loading @@ -11,11 +11,19 @@ operation Any oclIsKindOf(t:Any) : Boolean { return self.isKindOf(t); } operation Any oclType() : Any { return self.type(); } operation Any oclAsType(t:Any) : Any { return self; } //TODO: does not seem to work operation Any union(other:Any) : Collection { return self.includingAll(other); } operation Any notEmpty() : Boolean { return not self.isEmpty(); } Loading @@ -29,6 +37,11 @@ operation String size() : Integer { return self.length(); } //TODO: is it possible to define custom predicated operations? //operation Collection isUnique() : Boolean { // return not self.isEmpty(); //} //Supporting operations operation Any getTestDescription() : Any { Loading Loading @@ -171,6 +184,7 @@ operation TDL!SpecialValueUse getDataType() : Any { } //Check if Behaviour is tester input event //TODO: this should be handled already in Ecore/OCL -> rename and test, then remove! operation TDL!Behaviour isTesterInputEvent() : Boolean { return self.oclIsKindOf(TimeOut) or self.oclIsKindOf(Quiescence) Loading @@ -179,3 +193,63 @@ operation TDL!Behaviour isTesterInputEvent() : Boolean { and self.target->exists(t | t.targetGate.component.role.name = 'Tester')); } //TODO: migrate to tdl.ecore? operation TDL!TestConfiguration compatibleWith(tc:TDL!TestConfiguration, cb:Set) : Boolean { //TODO:copy and adapt from previous draft, add connections //self: configuration of invoked test description / TConf2 //tc: configuration of invoking test description / TConf1 //formalComponent: component in invoked test description //actualComponent: component in invoking test description if ( //same test configuration shortcut? bindings necessary //(self = tc and cb->isEmpty()) or //valid bindings exist (validity deferred to binding constraints) (self.componentInstance->forAll(c | cb.exists(b | b.formalComponent = c)) and self.connection->forAll(c | c.hasMatchingConnection(tc, cb)) ) ) { return true; } return false; } //helper //TODO: move to tdl.ecore in case as well //TODO: assumes binding exists, handle same? operation TDL!ComponentInstance getActualComponent(cb: Set) : TDL!ComponentInstance { return cb->select(b | b.formalComponent = self)->first().actualComponent; } //helper //TODO: move to tdl.ecore in case as well? //TODO: assumes binding exists, handle same? //operation TDL!GateInstance getActualGate(cb: Set) : TDL!GateInstance { // return cb->select(b | b.formalComponent = self)->first().actualComponent; //} //helper - get candidate matching connections with corresponding components //TODO: move to tdl.ecore in case as well? operation TDL!Connection getMatchingConnections(tc: TDL!TestConfiguration, cb: Set) : Set { return tc.connection->select(p | (p.endPoint->at(0).component = self.endPoint->at(0).component.getActualComponent(cb) and p.endPoint->at(1).component = self.endPoint->at(1).component.getActualComponent(cb)) or (p.endPoint->at(1).component = self.endPoint->at(0).component.getActualComponent(cb) and p.endPoint->at(0).component = self.endPoint->at(1).component.getActualComponent(cb)) ); } //helper - get matching connections with corresponding components operation Set perfectMatchExists(c:TDL!Connection) : Boolean { return self->exists(m | (m.endPoint->at(0).gate.type = c.endPoint->at(0).gate.type and m.endPoint->at(1).gate.type = c.endPoint->at(1).gate.type) or (m.endPoint->at(0).gate.type = c.endPoint->at(1).gate.type and m.endPoint->at(1).gate.type = c.endPoint->at(0).gate.type) ); } //helper - get check if there is perfect matching connection operation TDL!Connection hasMatchingConnection(tc: TDL!TestConfiguration, cb: Set) : Boolean { return self.getMatchingConnections(tc, cb).perfectMatchExists(self); }