Commit f984434c authored by Faezeh KHORRAM's avatar Faezeh KHORRAM 💬
Browse files

update tdl interpreter

parent f030857d
......@@ -153,7 +153,7 @@ class GateInstanceAspect {
return _self.gateLauncher.executeOCLCommand(query.value)
}else if (arg.dataInstance.dataType.isAcceptedEvent(_self.DSLPath)){
//the message is an event conforming to the behavioral interface of the DSL
return _self.gateLauncher.executeDSLSpecificCommand(arg.dataInstance.name, _self.getEventParameters(arg))
return _self.gateLauncher.executeDSLSpecificCommand(arg.dataInstance.validName, _self.getEventParameters(arg))
}
return "FAIL: Cannot send data to the MUT"
}
......@@ -180,12 +180,12 @@ class GateInstanceAspect {
def Map<String, Object> getEventParameters(DataInstanceUse event){
var Map<String, Object> parameters = new HashMap;
for (i : 0 ..<event.argument.size){//the parameterBindings of the event
val DataUse parameter = event.argument.get(i).dataUse
if (parameter instanceof DataInstanceUse){
val DataInstanceUse param = parameter
val argName = event.argument.get(i).parameter.name
val DataUse argValue = event.argument.get(i).dataUse
if (argValue instanceof DataInstanceUse){
//put the name of the parameter along with its matched object in the MUTResource
parameters.put(param.dataInstance.name,
param.getMatchedMUTElement(_self.gateLauncher.MUTResource, true, _self.DSLPath))
val value = (argValue as DataInstanceUse).getMatchedMUTElement(_self.gateLauncher.MUTResource, true, _self.DSLPath)
parameters.put(argName, value)
}
}
return parameters
......
......@@ -106,6 +106,13 @@ class DataInstanceAspect{
def EObject getMatchedMUTElement(ArrayList<EObject> rootElement, Resource MUTResource, boolean isAssertion, String DSLPath){
}
def String getValidName(){
var tdlName = _self.name
if (_self.name.startsWith("_")){
return tdlName.substring(1)
}
return tdlName
}
}
@Aspect (className = SimpleDataInstance)
class SimpleDataInstanceAspect extends DataInstanceAspect{
......@@ -126,15 +133,15 @@ class StructuredDataInstanceAspect extends DataInstanceAspect{
matchedElement = rootElement.get(i)
var boolean elementFound = true;
for (j : 0 ..<_self.memberAssignment.size){
val memberAssign = _self.memberAssignment.get(j)
if (isAssertion){//all the arguments (static and dynamic) have to be matched
_self.info = _self.memberAssignment.get(j).isMatchedMember(matchedElement, MUTResource, DSLPath)
_self.info = memberAssign.isMatchedMember(matchedElement, MUTResource, DSLPath)
if(_self.info.contains("FAIL")){
elementFound = false
}
}else{//only static arguments have to be matched
if (!_self.memberAssignment.get(j).member.dataType.isDynamicType
&& !_self.memberAssignment.get(j).member.isDynamicMember){
_self.info = _self.memberAssignment.get(j).isMatchedMember(matchedElement, MUTResource, DSLPath)
if (!memberAssign.member.dataType.isDynamicType && !memberAssign.member.isDynamicMember){
_self.info = memberAssign.isMatchedMember(matchedElement, MUTResource, DSLPath)
if(_self.info.contains("FAIL")){
elementFound = false
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment