|
Re: passing parameters from one block to another [message #652529 is a reply to message #652526] |
Fri, 04 February 2011 12:35 |
|
Hello Ravi,
without knowing you actual metamodel (the following is unreadable to me)
Quote: |
TestCase -------main class contains
/ \
/ \
blocks links
/ | \
/ | \
start make end blocks
|
it is hard to give concrete advice.
but
(1) you can pass additional parameters to templates
(2) you can naivigate the model up and down
(3) you can do sorting / filterting etc.
With some more information (metamodel/model) it can give more advice.
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: passing parameters from one block to another [message #652563 is a reply to message #652531] |
Fri, 04 February 2011 14:37 |
Ravi Kiran Messages: 41 Registered: December 2010 |
Member |
|
|
Hi chris
thanks once again for replying
if i pass parameters like that in expand
i will have to define parameters for all the blocks unnecessarily.
plz find
my whole template code
------------------------------------------------------------
«IMPORT mist»
«DEFINE main FOR TestCase»
«FILE name +".mist"»
«REM»
«FOREACH linkRef AS lk»
«IF lk.sourceBlock.name=="start"»
hhhhhhh
«ENDIF»
«ENDFOREACH»
«FOREACH blockRef AS blocks»
«blocks.name»
«ENDFOREACH»
«ENDREM»
«EXPAND blk FOREACH blockRef SEPARATOR '#########################'»
«ENDFILE»
«ENDDEFINE»
«DEFINE blk FOR block»
#could not find the matching block for this call
«ENDDEFINE»
«DEFINE blk FOR StartBlock»
#********************
#** MIST-IP-PHONES:
ipphone(«dn1»)
ipphone(«dn2»)
#********************
repeat(100)
OpenServer(«servername»,«Sipport»,«applicationname»)
WaitTevent(NULL,1000,LinkConnected)
if(LAST>=0) leave
again
ipRegister(«dn1»,«servername»:«Tlibport»)
ipRegister(«dn2»,«servername»:«Tlibport»)
#********************
#** MIST-REGISTRATION:
RegisterAddress(abstract)
ExpectTevent(abstract, WaitTime, Registered)
RegisterAddress(«dn1»)
ExpectTevent(«dn1», WaitTime, Registered)
RegisterAddress(«dn2»)
ExpectTevent(«dn2», WaitTime, Registered)
«IF this.Dn1type.toString().startsWith("Extension") && this.Dn2type.toString().startsWith("Extension")»
Utc3pccMakeCallInternal(«dn1»,«dn2»,"RETURN_AFTER_ESTABLISHED ")
«ELSEIF this.Dn1type.toString().startsWith("Extension") && this.Dn2type.toString().startsWith("Trunk") »
Utc3pccMakeCallOutbound(«dn1»,«dn2»,"RETURN_AFTER_ESTABLISHED ")
«ELSEIF this.Dn1type.toString().startsWith("Extension") && this.Dn2type.toString().startsWith("TrunkGroup")»
UtcMakeCallLocaToExtTg(«dn1»,«dn2»)
«ELSEIF this.Dn1type.toString().startsWith("Extension") && this.Dn2type.toString().startsWith("RoutingPoint")»
UtcMakeCallLocToRp(«dn1»,«dn2»)
«ENDIF»
«ENDDEFINE»
«DEFINE blk FOR MakeCallBlock»
«StartBlock.getProperty("dn1")»
some make call code.........
«ENDDEFINE»
«DEFINE blk FOR EndBlock»
#exit
exit(expect_error)
teardown:
putln(result,"*** TEARDOWN ***")
exit(-1)
«ENDDEFINE»
«DEFINE lnk FOR link»
this a link from «sourceBlock.name» to «destinationBlock.name»
«ENDDEFINE»
-----------------------------------------------------
now i want to use the dn1type and dn2type parameter of startblock in makecall block
please find my ecore file
------------------------------------------------------------ -------------
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mist"
nsURI="http://mist.ecore" nsPrefix="mist">
<eClassifiers xsi:type="ecore:EClass" name="TestCase">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blockRef" upperBound="-1"
eType="#//block" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="linkRef" upperBound="-1"
eType="#//link" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="block" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="link">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceBlock" eType="#//block"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="destinationBlock" eType="#//block"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="StartBlock" eSuperTypes="#//block">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="0"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Dn1type" eType="#//DNTypes"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="servername" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="host"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Sipport" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="Sipport"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="applicationname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="app"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dn1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="dn1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dn2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Tlibport" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="Tlibport"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Dn2type" eType="#//DNTypes"
defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="EndBlock" eSuperTypes="#//block">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="3"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MakeCallBlock" eSuperTypes="#//block">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="2"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="DN1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="dn1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="DN2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="dn2"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="DNTypes">
<eLiterals name="ACDQueue"/>
<eLiterals name="Extension" value="1"/>
<eLiterals name="RoutingQueue" value="2"/>
<eLiterals name="Trunk" value="3"/>
<eLiterals name="TrunkGroup" value="4"/>
<eLiterals name="VirtualQueue" value="6"/>
<eLiterals name="VoiceoverIpService" value="7"/>
<eLiterals name="VoiceTreatmentPort" value="8"/>
</eClassifiers>
</ecore:EPackage>
------------------------------------------------------------ --------------
Thanks for your patience
|
|
|
|
|
|
Re: passing parameters from one block to another [message #652630 is a reply to message #652619] |
Fri, 04 February 2011 18:48 |
|
Hi,
same as before: use xtend to navigate on the model
import mist;
List[block] getSuccessors(block in) :
((TestCase)in.eContainer).linkRef.select(e|e.sourceBlock == in).destinationBlock;
maybe you should start with the startblock(s) in the testcase
«DEFINE main FOR TestCase»
...
«EXPAND handleStartBlock FOREACH blockRef.typeSelect(StartBlock)»
...
«ENDDEFINE»
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Powered by
FUDForum. Page generated in 0.03978 seconds