test_mvc.py 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153
  1. import unittest
  2. from utils import *
  3. import sys
  4. sys.path.append("wrappers")
  5. from modelverse import *
  6. expected_model_list = set([" SimpleClassDiagrams : SimpleClassDiagrams",
  7. " CoreFormalism : SimpleClassDiagrams",
  8. " ManualOperation : SimpleClassDiagrams",
  9. " ActionLanguage : SimpleClassDiagrams",
  10. " ProcessModel : SimpleClassDiagrams",
  11. " Tracability : SimpleClassDiagrams",
  12. " core : CoreFormalism"])
  13. expected_model_full_list = set([" 221 root admin SimpleClassDiagrams : SimpleClassDiagrams",
  14. " 221 root admin CoreFormalism : SimpleClassDiagrams",
  15. " 221 root admin ActionLanguage : SimpleClassDiagrams",
  16. " 221 root admin ManualOperation : SimpleClassDiagrams",
  17. " 221 root admin ProcessModel : SimpleClassDiagrams",
  18. " 221 root admin Tracability : SimpleClassDiagrams",
  19. " 200 root admin core : CoreFormalism"])
  20. class TestModelverseCore(unittest.TestCase):
  21. @classmethod
  22. def setup_class(self):
  23. self.proc, self.address = start_mvc()
  24. @classmethod
  25. def teardown_class(self):
  26. kill(self.proc)
  27. def test_list_NEW(self):
  28. print("Open connection to " + str(self.address))
  29. init(self.address)
  30. login("admin", "admin")
  31. print(model_list())
  32. def test_list(self):
  33. self.assertTrue(run_file(all_files,
  34. [ "root", "root", "root",
  35. "model_list",
  36. ],
  37. [ "Desired username for admin user?",
  38. "Desired password for admin user?",
  39. "Please repeat the password",
  40. "Passwords match!",
  41. "Welcome to the Model Management Interface v2.0!",
  42. "Use the 'help' command for a list of possible commands",
  43. "Ready for command...",
  44. set(model_list),
  45. ]))
  46. def test_list_full(self):
  47. self.assertTrue(run_file(all_files,
  48. [ "root", "root", "root",
  49. "model_list_full",
  50. ],
  51. [ "Desired username for admin user?",
  52. "Desired password for admin user?",
  53. "Please repeat the password",
  54. "Passwords match!",
  55. "Welcome to the Model Management Interface v2.0!",
  56. "Use the 'help' command for a list of possible commands",
  57. "Ready for command...",
  58. set(model_full_list),
  59. ]))
  60. def test_model_add_empty(self):
  61. self.assertTrue(run_file(all_files,
  62. [ "root", "root", "root",
  63. "model_add",
  64. "SimpleClassDiagrams",
  65. "Empty",
  66. "exit",
  67. "model_list",
  68. "model_list_full",
  69. ],
  70. [ "Desired username for admin user?",
  71. "Desired password for admin user?",
  72. "Please repeat the password",
  73. "Passwords match!",
  74. "Welcome to the Model Management Interface v2.0!",
  75. "Use the 'help' command for a list of possible commands",
  76. "Ready for command...",
  77. "Creating new model!",
  78. "Model type?",
  79. "Model name?",
  80. "Waiting for model constructors...",
  81. "Model upload success!",
  82. "Ready for command...",
  83. set(model_list) |
  84. set([" Empty : SimpleClassDiagrams",]),
  85. "Ready for command...",
  86. set(model_full_list) |
  87. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  88. ]))
  89. def test_model_empty_modify(self):
  90. self.assertTrue(run_file(all_files,
  91. [ "root", "root", "root",
  92. "model_add",
  93. "SimpleClassDiagrams",
  94. "Empty",
  95. "exit",
  96. "model_list",
  97. "model_list_full",
  98. "model_modify",
  99. "Empty",
  100. "instantiate",
  101. "Class",
  102. "A",
  103. "exit",
  104. "model_list_full",
  105. ],
  106. [ "Desired username for admin user?",
  107. "Desired password for admin user?",
  108. "Please repeat the password",
  109. "Passwords match!",
  110. "Welcome to the Model Management Interface v2.0!",
  111. "Use the 'help' command for a list of possible commands",
  112. "Ready for command...",
  113. "Creating new model!",
  114. "Model type?",
  115. "Model name?",
  116. "Waiting for model constructors...",
  117. "Model upload success!",
  118. "Ready for command...",
  119. set(model_list) |
  120. set([" Empty : SimpleClassDiagrams",]),
  121. "Ready for command...",
  122. set(model_full_list) |
  123. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  124. "Ready for command...",
  125. "Which model do you want to modify?",
  126. "Model loaded, ready for commands!",
  127. "Mode: r/w",
  128. "Use 'help' command for a list of possible commands",
  129. "Please give your command.",
  130. "Type to instantiate?",
  131. "Name of new element?",
  132. "Instantiation successful!",
  133. None,
  134. "Please give your command.",
  135. "Ready for command...",
  136. set(model_full_list) |
  137. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  138. "Ready for command...",
  139. ]))
  140. def test_model_overwrite(self):
  141. self.assertTrue(run_file(all_files,
  142. [ "root", "root", "root",
  143. "model_add",
  144. "SimpleClassDiagrams",
  145. "Empty",
  146. "exit",
  147. "model_list_full",
  148. "model_modify",
  149. "Empty",
  150. "instantiate",
  151. "Class",
  152. "A",
  153. "exit",
  154. "model_list_full",
  155. "model_overwrite",
  156. "Empty",
  157. "instantiate_node",
  158. "",
  159. "Class",
  160. "B",
  161. "instantiate_node",
  162. "",
  163. "Class",
  164. "C",
  165. "exit",
  166. "model_list_full",
  167. "model_modify",
  168. "Empty",
  169. "list",
  170. "exit",
  171. ],
  172. [ "Desired username for admin user?",
  173. "Desired password for admin user?",
  174. "Please repeat the password",
  175. "Passwords match!",
  176. "Welcome to the Model Management Interface v2.0!",
  177. "Use the 'help' command for a list of possible commands",
  178. "Ready for command...",
  179. "Creating new model!",
  180. "Model type?",
  181. "Model name?",
  182. "Waiting for model constructors...",
  183. "Model upload success!",
  184. "Ready for command...",
  185. set(model_full_list) |
  186. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  187. "Ready for command...",
  188. "Which model do you want to modify?",
  189. "Model loaded, ready for commands!",
  190. "Mode: r/w",
  191. "Use 'help' command for a list of possible commands",
  192. "Please give your command.",
  193. "Type to instantiate?",
  194. "Name of new element?",
  195. "Instantiation successful!",
  196. None,
  197. "Please give your command.",
  198. "Ready for command...",
  199. set(model_full_list) |
  200. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  201. "Ready for command...",
  202. "Which model to overwrite?",
  203. "Waiting for model constructors...",
  204. "Model overwrite success!",
  205. "Ready for command...",
  206. set(model_full_list) |
  207. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  208. "Ready for command...",
  209. "Which model do you want to modify?",
  210. "Model loaded, ready for commands!",
  211. "Mode: r/w",
  212. "Use 'help' command for a list of possible commands",
  213. "Please give your command.",
  214. "List of all elements:",
  215. set([" B : Class",
  216. " C : Class"]),
  217. "Please give your command.",
  218. "Ready for command...",
  219. ]))
  220. def test_transform_add_MT_language(self):
  221. self.assertTrue(run_file(all_files,
  222. [ "root", "root", "root",
  223. "model_add",
  224. "SimpleClassDiagrams",
  225. "PetriNets",
  226. ] + get_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
  227. "model_list_full",
  228. "transformation_add_MT_language",
  229. "PetriNets",
  230. "",
  231. "PetriNets_RAM",
  232. "model_list_full",
  233. ],
  234. [ "Desired username for admin user?",
  235. "Desired password for admin user?",
  236. "Please repeat the password",
  237. "Passwords match!",
  238. "Welcome to the Model Management Interface v2.0!",
  239. "Use the 'help' command for a list of possible commands",
  240. "Ready for command...",
  241. "Creating new model!",
  242. "Model type?",
  243. "Model name?",
  244. "Waiting for model constructors...",
  245. "Model upload success!",
  246. "Ready for command...",
  247. set(model_full_list) |
  248. set([" 200 root nobody PetriNets : SimpleClassDiagrams",]),
  249. "Ready for command...",
  250. "Formalisms to include (terminate with empty string)?",
  251. "Name of the RAMified transformation metamodel?",
  252. "Ready for command...",
  253. set(model_full_list) |
  254. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  255. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  256. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",]),
  257. "Ready for command...",
  258. ]))
  259. def test_transform_add_MT_instance(self):
  260. self.assertTrue(run_file(all_files,
  261. [ "root", "root", "root",
  262. "model_add",
  263. "SimpleClassDiagrams",
  264. "PetriNets",
  265. ] + get_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
  266. "model_list_full",
  267. "transformation_add_MT_language",
  268. "PetriNets",
  269. "",
  270. "PetriNets_RAM",
  271. "model_list_full",
  272. "transformation_add_MT",
  273. "PetriNets_RAM",
  274. "PetriNets",
  275. "",
  276. "",
  277. "PetriNets_Print",
  278. "exit",
  279. "model_list_full",
  280. "transformation_list",
  281. "transformation_list_full",
  282. ],
  283. [ "Desired username for admin user?",
  284. "Desired password for admin user?",
  285. "Please repeat the password",
  286. "Passwords match!",
  287. "Welcome to the Model Management Interface v2.0!",
  288. "Use the 'help' command for a list of possible commands",
  289. "Ready for command...",
  290. "Creating new model!",
  291. "Model type?",
  292. "Model name?",
  293. "Waiting for model constructors...",
  294. "Model upload success!",
  295. "Ready for command...",
  296. set(model_full_list) |
  297. set([" 200 root nobody PetriNets : SimpleClassDiagrams",]),
  298. "Ready for command...",
  299. "Formalisms to include (terminate with empty string)?",
  300. "Name of the RAMified transformation metamodel?",
  301. "Ready for command...",
  302. set(model_full_list) |
  303. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  304. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  305. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",]),
  306. "Ready for command...",
  307. "RAMified metamodel to use?",
  308. "Supported metamodels:",
  309. set([" PetriNets",
  310. ]),
  311. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  312. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  313. "Name of new operation?",
  314. "Waiting for model constructors...",
  315. "Ready for command...",
  316. set(model_full_list) |
  317. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  318. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  319. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",
  320. " 200 root nobody PetriNets_Print : PetriNets_RAM",]),
  321. "Ready for command...",
  322. set(["[ModelTransformation] PetriNets_Print : PetriNets_RAM",
  323. ]),
  324. "Ready for command...",
  325. set([" 200 root nobody [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  326. ]),
  327. "Ready for command...",
  328. ]))
  329. def test_transform_add_MT_pn_print_upload(self):
  330. self.assertTrue(run_file(all_files,
  331. [ "root", "root", "root",
  332. "model_add",
  333. "SimpleClassDiagrams",
  334. "PetriNets",
  335. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  336. "model_list_full",
  337. "transformation_add_MT_language",
  338. "PetriNets",
  339. "",
  340. "PetriNets_RAM",
  341. "model_list_full",
  342. "transformation_add_MT",
  343. "PetriNets_RAM",
  344. "PetriNets",
  345. "",
  346. "",
  347. "PetriNets_Print",
  348. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  349. "transformation_list_full",
  350. ],
  351. [ "Desired username for admin user?",
  352. "Desired password for admin user?",
  353. "Please repeat the password",
  354. "Passwords match!",
  355. "Welcome to the Model Management Interface v2.0!",
  356. "Use the 'help' command for a list of possible commands",
  357. "Ready for command...",
  358. "Creating new model!",
  359. "Model type?",
  360. "Model name?",
  361. "Waiting for model constructors...",
  362. "Model upload success!",
  363. "Ready for command...",
  364. set(model_full_list) |
  365. set([" 200 root nobody PetriNets : SimpleClassDiagrams",]),
  366. "Ready for command...",
  367. "Formalisms to include (terminate with empty string)?",
  368. "Name of the RAMified transformation metamodel?",
  369. "Ready for command...",
  370. set(model_full_list) |
  371. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  372. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  373. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",]),
  374. "Ready for command...",
  375. "RAMified metamodel to use?",
  376. "Supported metamodels:",
  377. set([" PetriNets",
  378. ]),
  379. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  380. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  381. "Name of new operation?",
  382. "Waiting for model constructors...",
  383. "Ready for command...",
  384. set([" 200 root nobody [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  385. ]),
  386. "Ready for command...",
  387. ]))
  388. def test_transform_add_MT_pn_print_exec(self):
  389. self.assertTrue(run_file(all_files,
  390. [ "root", "root", "root",
  391. "model_add",
  392. "SimpleClassDiagrams",
  393. "PetriNets",
  394. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  395. "model_add",
  396. "PetriNets",
  397. "my_pn",
  398. ] + get_model_constructor(open("integration/code/pn_runtime_model.mvc", "r").read()) + [
  399. "model_list_full",
  400. "transformation_add_MT_language",
  401. "PetriNets",
  402. "",
  403. "PetriNets_RAM",
  404. "model_list_full",
  405. "transformation_add_MT",
  406. "PetriNets_RAM",
  407. "PetriNets",
  408. "",
  409. "",
  410. "PetriNets_Print",
  411. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  412. "transformation_list_full",
  413. "transformation_execute",
  414. "PetriNets_Print",
  415. "my_pn",
  416. "transformation_list_full",
  417. ],
  418. [ "Desired username for admin user?",
  419. "Desired password for admin user?",
  420. "Please repeat the password",
  421. "Passwords match!",
  422. "Welcome to the Model Management Interface v2.0!",
  423. "Use the 'help' command for a list of possible commands",
  424. "Ready for command...",
  425. "Creating new model!",
  426. "Model type?",
  427. "Model name?",
  428. "Waiting for model constructors...",
  429. "Model upload success!",
  430. "Ready for command...",
  431. "Creating new model!",
  432. "Model type?",
  433. "Model name?",
  434. "Waiting for model constructors...",
  435. "Model upload success!",
  436. "Ready for command...",
  437. set(model_full_list) |
  438. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  439. " 200 root nobody my_pn : PetriNets",]),
  440. "Ready for command...",
  441. "Formalisms to include (terminate with empty string)?",
  442. "Name of the RAMified transformation metamodel?",
  443. "Ready for command...",
  444. set(model_full_list) |
  445. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  446. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  447. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",
  448. " 200 root nobody my_pn : PetriNets",]),
  449. "Ready for command...",
  450. "RAMified metamodel to use?",
  451. "Supported metamodels:",
  452. set([" PetriNets",
  453. ]),
  454. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  455. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  456. "Name of new operation?",
  457. "Waiting for model constructors...",
  458. "Ready for command...",
  459. set([" 200 root nobody [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  460. ]),
  461. "Ready for command...",
  462. "Which transformation do you want to execute?",
  463. "Which model to bind for source type PetriNets",
  464. set(['"p1" --> 1',
  465. '"p2" --> 2',
  466. '"p3" --> 3',
  467. ]),
  468. "Ready for command...",
  469. ]))
  470. def test_transform_add_MT_pn_simulate(self):
  471. """
  472. This method tests the execution of a somewhat realistic use of the Modelverse and its core functions, through the use of a simple Petri nets example.
  473. First, Petri net metamodels are created for both the design language and the runtime language.
  474. Both languages only differ marginally from each other, with the runtime language only adding information on the currently selected transition for execution.
  475. Afterwards, a trivial Petri net model is created in the design language.
  476. This part tests the domain-specific and meta-modelling concepts of the Modelverse.
  477. After all models are created, transformations are defined to map between both languages: from design to runtime, and vice versa.
  478. Additional transformations are created for in-place model simulation and the printing of a Petri net model.
  479. This tests the modification of models, through the use of model transformations.
  480. Due to the use of a separate design and runtime language, we test exogenous transformations.
  481. The simulation transformation takes a single step in the Petri net model, by firing one of the applicable transitions, and therefore tests endogenous transformations.
  482. """
  483. self.assertTrue(run_file(all_files,
  484. [ "root", "root", "root",
  485. "model_add",
  486. "SimpleClassDiagrams",
  487. "PetriNets",
  488. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  489. "model_add",
  490. "SimpleClassDiagrams",
  491. "PetriNets_Runtime",
  492. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  493. "model_add",
  494. "PetriNets",
  495. "my_pn",
  496. ] + get_model_constructor(open("integration/code/pn_design_model.mvc", "r").read()) + [
  497. "model_list",
  498. "transformation_add_MT_language",
  499. "PetriNets_Runtime",
  500. "PetriNets",
  501. "",
  502. "PetriNets_RAM",
  503. "model_list",
  504. "model_modify",
  505. "__merged_PetriNets_RAM",
  506. "instantiate",
  507. "Association",
  508. "D2R_PlaceLink",
  509. "PetriNets/Place",
  510. "PetriNets_Runtime/Place",
  511. "instantiate",
  512. "Association",
  513. "D2R_TransitionLink",
  514. "PetriNets/Transition",
  515. "PetriNets_Runtime/Transition",
  516. "instantiate",
  517. "Association",
  518. "R2D_PlaceLink",
  519. "PetriNets_Runtime/Place",
  520. "PetriNets/Place",
  521. "instantiate",
  522. "Association",
  523. "R2D_TransitionLink",
  524. "PetriNets_Runtime/Transition",
  525. "PetriNets/Transition",
  526. "exit",
  527. "transformation_RAMify",
  528. "__merged_PetriNets_RAM",
  529. "PetriNets_RAM",
  530. "transformation_add_MT",
  531. "PetriNets_RAM",
  532. "PetriNets",
  533. "",
  534. "PetriNets_Runtime",
  535. "",
  536. "pn_design_to_runtime",
  537. ] + get_model_constructor(open("integration/code/pn_design_to_runtime.mvc", "r").read()) + [
  538. "transformation_add_MT",
  539. "PetriNets_RAM",
  540. "PetriNets_Runtime",
  541. "",
  542. "PetriNets",
  543. "",
  544. "pn_runtime_to_design",
  545. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  546. "transformation_add_MT",
  547. "PetriNets_RAM",
  548. "PetriNets_Runtime",
  549. "",
  550. "PetriNets_Runtime",
  551. "",
  552. "pn_step",
  553. ] + get_model_constructor(open("integration/code/pn_simulate.mvc", "r").read()) + [
  554. "transformation_add_MT",
  555. "PetriNets_RAM",
  556. "PetriNets",
  557. "",
  558. "",
  559. "pn_print",
  560. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  561. "model_list",
  562. "transformation_list",
  563. "transformation_execute",
  564. "pn_print",
  565. "my_pn",
  566. "transformation_execute",
  567. "pn_design_to_runtime",
  568. "my_pn",
  569. "my_pn_runtime",
  570. "transformation_execute",
  571. "pn_step",
  572. "my_pn_runtime",
  573. "my_pn_runtime",
  574. "transformation_execute",
  575. "pn_runtime_to_design",
  576. "my_pn_runtime",
  577. "my_pn",
  578. "transformation_execute",
  579. "pn_print",
  580. "my_pn",
  581. ],
  582. [ # bootup phase
  583. "Desired username for admin user?",
  584. "Desired password for admin user?",
  585. "Please repeat the password",
  586. "Passwords match!",
  587. "Welcome to the Model Management Interface v2.0!",
  588. "Use the 'help' command for a list of possible commands",
  589. "Ready for command...",
  590. # model_add
  591. "Creating new model!",
  592. "Model type?",
  593. "Model name?",
  594. "Waiting for model constructors...",
  595. "Model upload success!",
  596. "Ready for command...",
  597. # model_add
  598. "Creating new model!",
  599. "Model type?",
  600. "Model name?",
  601. "Waiting for model constructors...",
  602. "Model upload success!",
  603. "Ready for command...",
  604. # model_add
  605. "Creating new model!",
  606. "Model type?",
  607. "Model name?",
  608. "Waiting for model constructors...",
  609. "Model upload success!",
  610. "Ready for command...",
  611. # model_list
  612. set(model_list) |
  613. set([
  614. " PetriNets : SimpleClassDiagrams",
  615. " my_pn : PetriNets",
  616. " PetriNets_Runtime : SimpleClassDiagrams",]),
  617. "Ready for command...",
  618. # transformation_add_MT_language
  619. "Formalisms to include (terminate with empty string)?",
  620. "Name of the RAMified transformation metamodel?",
  621. "Ready for command...",
  622. # model_list
  623. set(model_list) |
  624. set([
  625. " PetriNets : SimpleClassDiagrams",
  626. " my_pn : PetriNets",
  627. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  628. " PetriNets_RAM : SimpleClassDiagrams",
  629. " PetriNets_Runtime : SimpleClassDiagrams",]),
  630. "Ready for command...",
  631. # model_modify
  632. "Which model do you want to modify?",
  633. "Model loaded, ready for commands!",
  634. "Mode: r/w",
  635. "Use 'help' command for a list of possible commands",
  636. "Please give your command.",
  637. # instantiate 1
  638. "Type to instantiate?",
  639. "Name of new element?",
  640. "Source name?",
  641. "Destination name?",
  642. "Instantiation successful!",
  643. None,
  644. "Please give your command.",
  645. # instantiate 2
  646. "Type to instantiate?",
  647. "Name of new element?",
  648. "Source name?",
  649. "Destination name?",
  650. "Instantiation successful!",
  651. None,
  652. "Please give your command.",
  653. # instantiate 3
  654. "Type to instantiate?",
  655. "Name of new element?",
  656. "Source name?",
  657. "Destination name?",
  658. "Instantiation successful!",
  659. None,
  660. "Please give your command.",
  661. # instantiate 4
  662. "Type to instantiate?",
  663. "Name of new element?",
  664. "Source name?",
  665. "Destination name?",
  666. "Instantiation successful!",
  667. None,
  668. "Please give your command.",
  669. "Ready for command...",
  670. # transformation_RAMify
  671. "Which metamodel do you want to RAMify?",
  672. "Where do you want to store the RAMified metamodel?",
  673. "Ready for command...",
  674. # transformation_add_MT
  675. "RAMified metamodel to use?",
  676. "Supported metamodels:",
  677. set([" PetriNets",
  678. " PetriNets_Runtime",
  679. ]),
  680. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  681. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  682. "Name of new operation?",
  683. "Waiting for model constructors...",
  684. "Ready for command...",
  685. # transformation_add_MT
  686. "RAMified metamodel to use?",
  687. "Supported metamodels:",
  688. set([" PetriNets",
  689. " PetriNets_Runtime",
  690. ]),
  691. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  692. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  693. "Name of new operation?",
  694. "Waiting for model constructors...",
  695. "Ready for command...",
  696. # transformation_add_MT
  697. "RAMified metamodel to use?",
  698. "Supported metamodels:",
  699. set([" PetriNets",
  700. " PetriNets_Runtime",
  701. ]),
  702. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  703. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  704. "Name of new operation?",
  705. "Waiting for model constructors...",
  706. "Ready for command...",
  707. # transformation_add_MT
  708. "RAMified metamodel to use?",
  709. "Supported metamodels:",
  710. set([" PetriNets",
  711. " PetriNets_Runtime",
  712. ]),
  713. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  714. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  715. "Name of new operation?",
  716. "Waiting for model constructors...",
  717. "Ready for command...",
  718. # model_list
  719. set(model_list) |
  720. set([
  721. " PetriNets : SimpleClassDiagrams",
  722. " my_pn : PetriNets",
  723. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  724. " PetriNets_RAM : SimpleClassDiagrams",
  725. " pn_print : PetriNets_RAM",
  726. " pn_design_to_runtime : PetriNets_RAM",
  727. " pn_runtime_to_design : PetriNets_RAM",
  728. " pn_step : PetriNets_RAM",
  729. " PetriNets_Runtime : SimpleClassDiagrams",]),
  730. "Ready for command...",
  731. # transformation_list
  732. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  733. "[ModelTransformation] pn_design_to_runtime : PetriNets_RAM",
  734. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  735. "[ModelTransformation] pn_step : PetriNets_RAM"]),
  736. "Ready for command...",
  737. # transformation_execute (pn_print)
  738. "Which transformation do you want to execute?",
  739. "Which model to bind for source type PetriNets",
  740. set(['"p1" --> 1',
  741. '"p2" --> 2',
  742. '"p3" --> 3',
  743. ]),
  744. "Ready for command...",
  745. # transformation_execute (pn_design_to_runtime)
  746. "Which transformation do you want to execute?",
  747. "Which model to bind for source type PetriNets",
  748. "Which model to create for target type PetriNets_Runtime",
  749. "Ready for command...",
  750. # transformation_execute (pn_step)
  751. "Which transformation do you want to execute?",
  752. "Which model to bind for source type PetriNets_Runtime",
  753. "Which model to create for target type PetriNets_Runtime",
  754. "Ready for command...",
  755. # transformation_execute (pn_runtime_to_design)
  756. "Which transformation do you want to execute?",
  757. "Which model to bind for source type PetriNets_Runtime",
  758. "Which model to create for target type PetriNets",
  759. "Ready for command...",
  760. # transformation_execute (pn_print)
  761. "Which transformation do you want to execute?",
  762. "Which model to bind for source type PetriNets",
  763. set(['"p1" --> 0',
  764. '"p2" --> 1',
  765. '"p3" --> 5',
  766. ]),
  767. "Ready for command...",
  768. ]))
  769. @slow
  770. def test_transform_add_MT_pn_simulate_larger(self):
  771. def step_and_print():
  772. return [ \
  773. # transformation_execute (pn_step)
  774. "Which transformation do you want to execute?",
  775. "Which model to bind for source type PetriNets_Runtime",
  776. "Which model to create for target type PetriNets_Runtime",
  777. "Ready for command...",
  778. # transformation_execute (pn_runtime_to_design)
  779. "Which transformation do you want to execute?",
  780. "Which model to bind for source type PetriNets_Runtime",
  781. "Which model to create for target type PetriNets",
  782. "Ready for command...",
  783. # transformation_execute (pn_print)
  784. "Which transformation do you want to execute?",
  785. "Which model to bind for source type PetriNets",
  786. None,
  787. None,
  788. None,
  789. "Ready for command...",
  790. ]
  791. self.assertTrue(run_file(all_files,
  792. [ "root", "root", "root",
  793. "model_add",
  794. "SimpleClassDiagrams",
  795. "PetriNets",
  796. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  797. "model_add",
  798. "SimpleClassDiagrams",
  799. "PetriNets_Runtime",
  800. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  801. "model_add",
  802. "PetriNets",
  803. "my_pn",
  804. ] + get_model_constructor(open("integration/code/pn_design_model_larger.mvc", "r").read()) + [
  805. "model_list",
  806. "transformation_add_MT_language",
  807. "PetriNets_Runtime",
  808. "PetriNets",
  809. "",
  810. "PetriNets_RAM",
  811. "model_list",
  812. "model_modify",
  813. "__merged_PetriNets_RAM",
  814. "instantiate",
  815. "Association",
  816. "D2R_PlaceLink",
  817. "PetriNets/Place",
  818. "PetriNets_Runtime/Place",
  819. "instantiate",
  820. "Association",
  821. "D2R_TransitionLink",
  822. "PetriNets/Transition",
  823. "PetriNets_Runtime/Transition",
  824. "instantiate",
  825. "Association",
  826. "R2D_PlaceLink",
  827. "PetriNets_Runtime/Place",
  828. "PetriNets/Place",
  829. "instantiate",
  830. "Association",
  831. "R2D_TransitionLink",
  832. "PetriNets_Runtime/Transition",
  833. "PetriNets/Transition",
  834. "exit",
  835. "transformation_RAMify",
  836. "__merged_PetriNets_RAM",
  837. "PetriNets_RAM",
  838. "transformation_add_MT",
  839. "PetriNets_RAM",
  840. "PetriNets",
  841. "",
  842. "PetriNets_Runtime",
  843. "",
  844. "pn_design_to_runtime",
  845. ] + get_model_constructor(open("integration/code/pn_design_to_runtime.mvc", "r").read()) + [
  846. "transformation_add_MT",
  847. "PetriNets_RAM",
  848. "PetriNets_Runtime",
  849. "",
  850. "PetriNets",
  851. "",
  852. "pn_runtime_to_design",
  853. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  854. "transformation_add_MT",
  855. "PetriNets_RAM",
  856. "PetriNets_Runtime",
  857. "",
  858. "PetriNets_Runtime",
  859. "",
  860. "pn_step",
  861. ] + get_model_constructor(open("integration/code/pn_simulate.mvc", "r").read()) + [
  862. "transformation_add_MT",
  863. "PetriNets_RAM",
  864. "PetriNets",
  865. "",
  866. "",
  867. "pn_print",
  868. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  869. "model_list",
  870. "transformation_list",
  871. "transformation_execute",
  872. "pn_print",
  873. "my_pn",
  874. "transformation_execute",
  875. "pn_design_to_runtime",
  876. "my_pn",
  877. "my_pn_runtime", ] + [
  878. "transformation_execute",
  879. "pn_step",
  880. "my_pn_runtime",
  881. "my_pn_runtime",
  882. "transformation_execute",
  883. "pn_runtime_to_design",
  884. "my_pn_runtime",
  885. "my_pn",
  886. "transformation_execute",
  887. "pn_print",
  888. "my_pn",
  889. ] * 10 + [
  890. ],
  891. [ # bootup phase
  892. "Desired username for admin user?",
  893. "Desired password for admin user?",
  894. "Please repeat the password",
  895. "Passwords match!",
  896. "Welcome to the Model Management Interface v2.0!",
  897. "Use the 'help' command for a list of possible commands",
  898. "Ready for command...",
  899. # model_add
  900. "Creating new model!",
  901. "Model type?",
  902. "Model name?",
  903. "Waiting for model constructors...",
  904. "Model upload success!",
  905. "Ready for command...",
  906. # model_add
  907. "Creating new model!",
  908. "Model type?",
  909. "Model name?",
  910. "Waiting for model constructors...",
  911. "Model upload success!",
  912. "Ready for command...",
  913. # model_add
  914. "Creating new model!",
  915. "Model type?",
  916. "Model name?",
  917. "Waiting for model constructors...",
  918. "Model upload success!",
  919. "Ready for command...",
  920. # model_list
  921. set(model_list) |
  922. set([
  923. " PetriNets : SimpleClassDiagrams",
  924. " my_pn : PetriNets",
  925. " PetriNets_Runtime : SimpleClassDiagrams",]),
  926. "Ready for command...",
  927. # transformation_add_MT_language
  928. "Formalisms to include (terminate with empty string)?",
  929. "Name of the RAMified transformation metamodel?",
  930. "Ready for command...",
  931. # model_list
  932. set(model_list) |
  933. set([
  934. " PetriNets : SimpleClassDiagrams",
  935. " my_pn : PetriNets",
  936. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  937. " PetriNets_RAM : SimpleClassDiagrams",
  938. " PetriNets_Runtime : SimpleClassDiagrams",]),
  939. "Ready for command...",
  940. # model_modify
  941. "Which model do you want to modify?",
  942. "Model loaded, ready for commands!",
  943. "Mode: r/w",
  944. "Use 'help' command for a list of possible commands",
  945. "Please give your command.",
  946. # instantiate 1
  947. "Type to instantiate?",
  948. "Name of new element?",
  949. "Source name?",
  950. "Destination name?",
  951. "Instantiation successful!",
  952. None,
  953. "Please give your command.",
  954. # instantiate 2
  955. "Type to instantiate?",
  956. "Name of new element?",
  957. "Source name?",
  958. "Destination name?",
  959. "Instantiation successful!",
  960. None,
  961. "Please give your command.",
  962. # instantiate 3
  963. "Type to instantiate?",
  964. "Name of new element?",
  965. "Source name?",
  966. "Destination name?",
  967. "Instantiation successful!",
  968. None,
  969. "Please give your command.",
  970. # instantiate 4
  971. "Type to instantiate?",
  972. "Name of new element?",
  973. "Source name?",
  974. "Destination name?",
  975. "Instantiation successful!",
  976. None,
  977. "Please give your command.",
  978. "Ready for command...",
  979. # transformation_RAMify
  980. "Which metamodel do you want to RAMify?",
  981. "Where do you want to store the RAMified metamodel?",
  982. "Ready for command...",
  983. # transformation_add_MT
  984. "RAMified metamodel to use?",
  985. "Supported metamodels:",
  986. set([" PetriNets",
  987. " PetriNets_Runtime",
  988. ]),
  989. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  990. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  991. "Name of new operation?",
  992. "Waiting for model constructors...",
  993. "Ready for command...",
  994. # transformation_add_MT
  995. "RAMified metamodel to use?",
  996. "Supported metamodels:",
  997. set([" PetriNets",
  998. " PetriNets_Runtime",
  999. ]),
  1000. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1001. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1002. "Name of new operation?",
  1003. "Waiting for model constructors...",
  1004. "Ready for command...",
  1005. # transformation_add_MT
  1006. "RAMified metamodel to use?",
  1007. "Supported metamodels:",
  1008. set([" PetriNets",
  1009. " PetriNets_Runtime",
  1010. ]),
  1011. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1012. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1013. "Name of new operation?",
  1014. "Waiting for model constructors...",
  1015. "Ready for command...",
  1016. # transformation_add_MT
  1017. "RAMified metamodel to use?",
  1018. "Supported metamodels:",
  1019. set([" PetriNets",
  1020. " PetriNets_Runtime",
  1021. ]),
  1022. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1023. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1024. "Name of new operation?",
  1025. "Waiting for model constructors...",
  1026. "Ready for command...",
  1027. # model_list
  1028. set(model_list) |
  1029. set([
  1030. " PetriNets : SimpleClassDiagrams",
  1031. " my_pn : PetriNets",
  1032. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1033. " PetriNets_RAM : SimpleClassDiagrams",
  1034. " pn_print : PetriNets_RAM",
  1035. " pn_design_to_runtime : PetriNets_RAM",
  1036. " pn_runtime_to_design : PetriNets_RAM",
  1037. " pn_step : PetriNets_RAM",
  1038. " PetriNets_Runtime : SimpleClassDiagrams",]),
  1039. "Ready for command...",
  1040. # transformation_list
  1041. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  1042. "[ModelTransformation] pn_design_to_runtime : PetriNets_RAM",
  1043. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  1044. "[ModelTransformation] pn_step : PetriNets_RAM"]),
  1045. "Ready for command...",
  1046. # transformation_execute (pn_print)
  1047. "Which transformation do you want to execute?",
  1048. "Which model to bind for source type PetriNets",
  1049. set(['"lock_available" --> 1',
  1050. '"critical_section_1" --> 0',
  1051. '"critical_section_2" --> 0',
  1052. ]),
  1053. "Ready for command...",
  1054. # transformation_execute (pn_design_to_runtime)
  1055. "Which transformation do you want to execute?",
  1056. "Which model to bind for source type PetriNets",
  1057. "Which model to create for target type PetriNets_Runtime",
  1058. "Ready for command...",
  1059. ] + \
  1060. step_and_print() * 10 +
  1061. []))
  1062. def test_transform_add_AL_pn_simulate(self):
  1063. self.assertTrue(run_file(all_files,
  1064. [ "root", "root", "root",
  1065. "model_add",
  1066. "SimpleClassDiagrams",
  1067. "PetriNets",
  1068. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  1069. "model_add",
  1070. "SimpleClassDiagrams",
  1071. "PetriNets_Runtime",
  1072. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  1073. "model_add",
  1074. "PetriNets",
  1075. "my_pn",
  1076. ] + get_model_constructor(open("integration/code/pn_design_model.mvc", "r").read()) + [
  1077. "model_list",
  1078. "transformation_add_MT_language",
  1079. "PetriNets_Runtime",
  1080. "PetriNets",
  1081. "",
  1082. "PetriNets_RAM",
  1083. "model_list",
  1084. "model_modify",
  1085. "__merged_PetriNets_RAM",
  1086. "instantiate",
  1087. "Association",
  1088. "D2R_PlaceLink",
  1089. "PetriNets/Place",
  1090. "PetriNets_Runtime/Place",
  1091. "instantiate",
  1092. "Association",
  1093. "D2R_TransitionLink",
  1094. "PetriNets/Transition",
  1095. "PetriNets_Runtime/Transition",
  1096. "instantiate",
  1097. "Association",
  1098. "R2D_PlaceLink",
  1099. "PetriNets_Runtime/Place",
  1100. "PetriNets/Place",
  1101. "instantiate",
  1102. "Association",
  1103. "R2D_TransitionLink",
  1104. "PetriNets_Runtime/Transition",
  1105. "PetriNets/Transition",
  1106. "exit",
  1107. "transformation_RAMify",
  1108. "__merged_PetriNets_RAM",
  1109. "PetriNets_RAM",
  1110. "transformation_add_MT",
  1111. "PetriNets_RAM",
  1112. "PetriNets",
  1113. "",
  1114. "PetriNets_Runtime",
  1115. "",
  1116. "pn_design_to_runtime",
  1117. ] + get_model_constructor(open("integration/code/pn_design_to_runtime.mvc", "r").read()) + [
  1118. "transformation_add_MT",
  1119. "PetriNets_RAM",
  1120. "PetriNets_Runtime",
  1121. "",
  1122. "PetriNets",
  1123. "",
  1124. "pn_runtime_to_design",
  1125. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  1126. "transformation_add_AL",
  1127. "PetriNets_Runtime",
  1128. "",
  1129. "PetriNets_Runtime",
  1130. "",
  1131. "pn_step",
  1132. ] + get_constructor(open("integration/code/pn_simulate.alc", "r").read()) + [
  1133. "transformation_add_MT",
  1134. "PetriNets_RAM",
  1135. "PetriNets",
  1136. "",
  1137. "",
  1138. "pn_print",
  1139. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  1140. "model_list",
  1141. "transformation_list",
  1142. "transformation_execute",
  1143. "pn_print",
  1144. "my_pn",
  1145. "transformation_execute",
  1146. "pn_design_to_runtime",
  1147. "my_pn",
  1148. "my_pn_runtime",
  1149. "transformation_execute",
  1150. "pn_step",
  1151. "my_pn_runtime",
  1152. "my_pn_runtime",
  1153. "transformation_execute",
  1154. "pn_runtime_to_design",
  1155. "my_pn_runtime",
  1156. "my_pn",
  1157. "transformation_execute",
  1158. "pn_print",
  1159. "my_pn",
  1160. ],
  1161. [ # bootup phase
  1162. "Desired username for admin user?",
  1163. "Desired password for admin user?",
  1164. "Please repeat the password",
  1165. "Passwords match!",
  1166. "Welcome to the Model Management Interface v2.0!",
  1167. "Use the 'help' command for a list of possible commands",
  1168. "Ready for command...",
  1169. # model_add
  1170. "Creating new model!",
  1171. "Model type?",
  1172. "Model name?",
  1173. "Waiting for model constructors...",
  1174. "Model upload success!",
  1175. "Ready for command...",
  1176. # model_add
  1177. "Creating new model!",
  1178. "Model type?",
  1179. "Model name?",
  1180. "Waiting for model constructors...",
  1181. "Model upload success!",
  1182. "Ready for command...",
  1183. # model_add
  1184. "Creating new model!",
  1185. "Model type?",
  1186. "Model name?",
  1187. "Waiting for model constructors...",
  1188. "Model upload success!",
  1189. "Ready for command...",
  1190. # model_list
  1191. set(model_list) |
  1192. set([" PetriNets : SimpleClassDiagrams",
  1193. " my_pn : PetriNets",
  1194. " PetriNets_Runtime : SimpleClassDiagrams",]),
  1195. "Ready for command...",
  1196. # transformation_add_MT_language
  1197. "Formalisms to include (terminate with empty string)?",
  1198. "Name of the RAMified transformation metamodel?",
  1199. "Ready for command...",
  1200. # model_list
  1201. set(model_list) |
  1202. set([
  1203. " PetriNets_Runtime : SimpleClassDiagrams",
  1204. " PetriNets : SimpleClassDiagrams",
  1205. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1206. " PetriNets_RAM : SimpleClassDiagrams",
  1207. " my_pn : PetriNets",]),
  1208. "Ready for command...",
  1209. # model_modify
  1210. "Which model do you want to modify?",
  1211. "Model loaded, ready for commands!",
  1212. "Mode: r/w",
  1213. "Use 'help' command for a list of possible commands",
  1214. "Please give your command.",
  1215. # instantiate 1
  1216. "Type to instantiate?",
  1217. "Name of new element?",
  1218. "Source name?",
  1219. "Destination name?",
  1220. "Instantiation successful!",
  1221. None,
  1222. "Please give your command.",
  1223. # instantiate 2
  1224. "Type to instantiate?",
  1225. "Name of new element?",
  1226. "Source name?",
  1227. "Destination name?",
  1228. "Instantiation successful!",
  1229. None,
  1230. "Please give your command.",
  1231. # instantiate 3
  1232. "Type to instantiate?",
  1233. "Name of new element?",
  1234. "Source name?",
  1235. "Destination name?",
  1236. "Instantiation successful!",
  1237. None,
  1238. "Please give your command.",
  1239. # instantiate 4
  1240. "Type to instantiate?",
  1241. "Name of new element?",
  1242. "Source name?",
  1243. "Destination name?",
  1244. "Instantiation successful!",
  1245. None,
  1246. "Please give your command.",
  1247. "Ready for command...",
  1248. # transformation_RAMify
  1249. "Which metamodel do you want to RAMify?",
  1250. "Where do you want to store the RAMified metamodel?",
  1251. "Ready for command...",
  1252. # transformation_add_MT
  1253. "RAMified metamodel to use?",
  1254. "Supported metamodels:",
  1255. set([" PetriNets",
  1256. " PetriNets_Runtime",
  1257. ]),
  1258. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1259. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1260. "Name of new operation?",
  1261. "Waiting for model constructors...",
  1262. "Ready for command...",
  1263. # transformation_add_MT
  1264. "RAMified metamodel to use?",
  1265. "Supported metamodels:",
  1266. set([" PetriNets",
  1267. " PetriNets_Runtime",
  1268. ]),
  1269. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1270. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1271. "Name of new operation?",
  1272. "Waiting for model constructors...",
  1273. "Ready for command...",
  1274. # transformation_add_AL
  1275. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1276. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1277. "Name of operation model?",
  1278. "Waiting for model constructors...",
  1279. "Ready for command...",
  1280. # transformation_add_MT
  1281. "RAMified metamodel to use?",
  1282. "Supported metamodels:",
  1283. set([" PetriNets",
  1284. " PetriNets_Runtime",
  1285. ]),
  1286. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1287. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1288. "Name of new operation?",
  1289. "Waiting for model constructors...",
  1290. "Ready for command...",
  1291. # model_list
  1292. set(model_list) |
  1293. set([
  1294. " PetriNets_Runtime : SimpleClassDiagrams",
  1295. " PetriNets : SimpleClassDiagrams",
  1296. " pn_print : PetriNets_RAM",
  1297. " pn_design_to_runtime : PetriNets_RAM",
  1298. " pn_runtime_to_design : PetriNets_RAM",
  1299. " pn_step : ActionLanguage",
  1300. " __merged_pn_step : SimpleClassDiagrams",
  1301. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1302. " PetriNets_RAM : SimpleClassDiagrams",
  1303. " my_pn : PetriNets",]),
  1304. "Ready for command...",
  1305. # transformation_list
  1306. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  1307. "[ModelTransformation] pn_design_to_runtime : PetriNets_RAM",
  1308. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  1309. "[ActionLanguage] pn_step : ActionLanguage"]),
  1310. "Ready for command...",
  1311. # transformation_execute (pn_print)
  1312. "Which transformation do you want to execute?",
  1313. "Which model to bind for source type PetriNets",
  1314. set(['"p1" --> 1',
  1315. '"p2" --> 2',
  1316. '"p3" --> 3',
  1317. ]),
  1318. "Ready for command...",
  1319. # transformation_execute (pn_design_to_runtime)
  1320. "Which transformation do you want to execute?",
  1321. "Which model to bind for source type PetriNets",
  1322. "Which model to create for target type PetriNets_Runtime",
  1323. "Ready for command...",
  1324. # transformation_execute (pn_step)
  1325. "Which transformation do you want to execute?",
  1326. "Which model to bind for source type PetriNets_Runtime",
  1327. "Which model to create for target type PetriNets_Runtime",
  1328. "Ready for command...",
  1329. # transformation_execute (pn_runtime_to_design)
  1330. "Which transformation do you want to execute?",
  1331. "Which model to bind for source type PetriNets_Runtime",
  1332. "Which model to create for target type PetriNets",
  1333. "Ready for command...",
  1334. # transformation_execute (pn_print)
  1335. "Which transformation do you want to execute?",
  1336. "Which model to bind for source type PetriNets",
  1337. set(['"p1" --> 0',
  1338. '"p2" --> 1',
  1339. '"p3" --> 5',
  1340. ]),
  1341. "Ready for command...",
  1342. ]))
  1343. def test_transform_add_MANUAL_pn_simulate(self):
  1344. self.assertTrue(run_file(all_files,
  1345. [ "root", "root", "root",
  1346. "model_add",
  1347. "SimpleClassDiagrams",
  1348. "PetriNets",
  1349. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  1350. "model_add",
  1351. "SimpleClassDiagrams",
  1352. "PetriNets_Runtime",
  1353. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  1354. "model_add",
  1355. "PetriNets",
  1356. "my_pn",
  1357. ] + get_model_constructor(open("integration/code/pn_design_model.mvc", "r").read()) + [
  1358. "model_list",
  1359. "transformation_add_MT_language",
  1360. "PetriNets_Runtime",
  1361. "PetriNets",
  1362. "",
  1363. "PetriNets_RAM",
  1364. "model_list",
  1365. "model_modify",
  1366. "__merged_PetriNets_RAM",
  1367. "instantiate",
  1368. "Association",
  1369. "D2R_PlaceLink",
  1370. "PetriNets/Place",
  1371. "PetriNets_Runtime/Place",
  1372. "instantiate",
  1373. "Association",
  1374. "D2R_TransitionLink",
  1375. "PetriNets/Transition",
  1376. "PetriNets_Runtime/Transition",
  1377. "instantiate",
  1378. "Association",
  1379. "R2D_PlaceLink",
  1380. "PetriNets_Runtime/Place",
  1381. "PetriNets/Place",
  1382. "instantiate",
  1383. "Association",
  1384. "R2D_TransitionLink",
  1385. "PetriNets_Runtime/Transition",
  1386. "PetriNets/Transition",
  1387. "exit",
  1388. "transformation_RAMify",
  1389. "__merged_PetriNets_RAM",
  1390. "PetriNets_RAM",
  1391. "transformation_add_MANUAL",
  1392. "PetriNets",
  1393. "",
  1394. "PetriNets_Runtime",
  1395. "",
  1396. "pn_design_to_runtime",
  1397. "transformation_add_MT",
  1398. "PetriNets_RAM",
  1399. "PetriNets_Runtime",
  1400. "",
  1401. "PetriNets",
  1402. "",
  1403. "pn_runtime_to_design",
  1404. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  1405. "transformation_add_MT",
  1406. "PetriNets_RAM",
  1407. "PetriNets_Runtime",
  1408. "",
  1409. "PetriNets_Runtime",
  1410. "",
  1411. "pn_step",
  1412. ] + get_model_constructor(open("integration/code/pn_simulate.mvc", "r").read()) + [
  1413. "transformation_add_MT",
  1414. "PetriNets_RAM",
  1415. "PetriNets",
  1416. "",
  1417. "",
  1418. "pn_print",
  1419. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  1420. "model_list",
  1421. "transformation_list",
  1422. "transformation_execute",
  1423. "pn_print",
  1424. "my_pn",
  1425. "transformation_execute",
  1426. "pn_design_to_runtime",
  1427. "my_pn",
  1428. "my_pn_runtime",
  1429. "instantiate", "PetriNets_Runtime/Place", "1",
  1430. "attr_add", "1", "tokens", 1,
  1431. "attr_add", "1", "name", "p1",
  1432. "instantiate", "PetriNets_Runtime/Place", "2",
  1433. "attr_add", "p2", "tokens", 2,
  1434. "attr_add", "p2", "name", "p2",
  1435. "instantiate", "PetriNets_Runtime/Place", "3",
  1436. "attr_add", "p3", "tokens", 3,
  1437. "attr_add", "p3", "name", "p3",
  1438. "instantiate", "PetriNets_Runtime/Transition", "4",
  1439. "attr_add", "4", "name", "t1",
  1440. "instantiate", "PetriNets_Runtime/P2T", "5", "1", "4",
  1441. "attr_add", "5", "weight", 1,
  1442. "instantiate", "PetriNets_Runtime/P2T", "6", "2", "4",
  1443. "attr_add", "6", "weight", 1,
  1444. "instantiate", "PetriNets_Runtime/T2P", "7", "4", "3",
  1445. "attr_add", "7", "weight", 2,
  1446. "exit",
  1447. "transformation_execute",
  1448. "pn_step",
  1449. "my_pn_runtime",
  1450. "my_pn_runtime",
  1451. "transformation_execute",
  1452. "pn_runtime_to_design",
  1453. "my_pn_runtime",
  1454. "my_pn",
  1455. "transformation_execute",
  1456. "pn_print",
  1457. "my_pn",
  1458. ],
  1459. [ # bootup phase
  1460. "Desired username for admin user?",
  1461. "Desired password for admin user?",
  1462. "Please repeat the password",
  1463. "Passwords match!",
  1464. "Welcome to the Model Management Interface v2.0!",
  1465. "Use the 'help' command for a list of possible commands",
  1466. "Ready for command...",
  1467. # model_add
  1468. "Creating new model!",
  1469. "Model type?",
  1470. "Model name?",
  1471. "Waiting for model constructors...",
  1472. "Model upload success!",
  1473. "Ready for command...",
  1474. # model_add
  1475. "Creating new model!",
  1476. "Model type?",
  1477. "Model name?",
  1478. "Waiting for model constructors...",
  1479. "Model upload success!",
  1480. "Ready for command...",
  1481. # model_add
  1482. "Creating new model!",
  1483. "Model type?",
  1484. "Model name?",
  1485. "Waiting for model constructors...",
  1486. "Model upload success!",
  1487. "Ready for command...",
  1488. # model_list
  1489. set(model_list) |
  1490. set([
  1491. " PetriNets : SimpleClassDiagrams",
  1492. " my_pn : PetriNets",
  1493. " PetriNets_Runtime : SimpleClassDiagrams",]),
  1494. "Ready for command...",
  1495. # transformation_add_MT_language
  1496. "Formalisms to include (terminate with empty string)?",
  1497. "Name of the RAMified transformation metamodel?",
  1498. "Ready for command...",
  1499. # model_list
  1500. set(model_list) |
  1501. set([
  1502. " PetriNets_Runtime : SimpleClassDiagrams",
  1503. " PetriNets : SimpleClassDiagrams",
  1504. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1505. " PetriNets_RAM : SimpleClassDiagrams",
  1506. " my_pn : PetriNets",]),
  1507. "Ready for command...",
  1508. # model_modify
  1509. "Which model do you want to modify?",
  1510. "Model loaded, ready for commands!",
  1511. "Mode: r/w",
  1512. "Use 'help' command for a list of possible commands",
  1513. "Please give your command.",
  1514. # instantiate 1
  1515. "Type to instantiate?",
  1516. "Name of new element?",
  1517. "Source name?",
  1518. "Destination name?",
  1519. "Instantiation successful!",
  1520. None,
  1521. "Please give your command.",
  1522. # instantiate 2
  1523. "Type to instantiate?",
  1524. "Name of new element?",
  1525. "Source name?",
  1526. "Destination name?",
  1527. "Instantiation successful!",
  1528. None,
  1529. "Please give your command.",
  1530. # instantiate 3
  1531. "Type to instantiate?",
  1532. "Name of new element?",
  1533. "Source name?",
  1534. "Destination name?",
  1535. "Instantiation successful!",
  1536. None,
  1537. "Please give your command.",
  1538. # instantiate 4
  1539. "Type to instantiate?",
  1540. "Name of new element?",
  1541. "Source name?",
  1542. "Destination name?",
  1543. "Instantiation successful!",
  1544. None,
  1545. "Please give your command.",
  1546. "Ready for command...",
  1547. # transformation_RAMify
  1548. "Which metamodel do you want to RAMify?",
  1549. "Where do you want to store the RAMified metamodel?",
  1550. "Ready for command...",
  1551. # transformation_add_MANUAL
  1552. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1553. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1554. "Name of operation model?",
  1555. "Ready for command...",
  1556. # transformation_add_MT
  1557. "RAMified metamodel to use?",
  1558. "Supported metamodels:",
  1559. set([" PetriNets",
  1560. " PetriNets_Runtime",
  1561. ]),
  1562. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1563. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1564. "Name of new operation?",
  1565. "Waiting for model constructors...",
  1566. "Ready for command...",
  1567. # transformation_add_MT
  1568. "RAMified metamodel to use?",
  1569. "Supported metamodels:",
  1570. set([" PetriNets",
  1571. " PetriNets_Runtime",
  1572. ]),
  1573. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1574. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1575. "Name of new operation?",
  1576. "Waiting for model constructors...",
  1577. "Ready for command...",
  1578. # transformation_add_MT
  1579. "RAMified metamodel to use?",
  1580. "Supported metamodels:",
  1581. set([" PetriNets",
  1582. " PetriNets_Runtime",
  1583. ]),
  1584. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1585. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1586. "Name of new operation?",
  1587. "Waiting for model constructors...",
  1588. "Ready for command...",
  1589. # model_list
  1590. set(model_list) |
  1591. set([
  1592. " PetriNets_Runtime : SimpleClassDiagrams",
  1593. " PetriNets : SimpleClassDiagrams",
  1594. " pn_print : PetriNets_RAM",
  1595. " pn_design_to_runtime : ManualOperation",
  1596. " pn_runtime_to_design : PetriNets_RAM",
  1597. " pn_step : PetriNets_RAM",
  1598. " __merged_pn_design_to_runtime : SimpleClassDiagrams",
  1599. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1600. " PetriNets_RAM : SimpleClassDiagrams",
  1601. " my_pn : PetriNets",]),
  1602. "Ready for command...",
  1603. # transformation_list
  1604. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  1605. "[ManualOperation] pn_design_to_runtime : ManualOperation",
  1606. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  1607. "[ModelTransformation] pn_step : PetriNets_RAM"]),
  1608. "Ready for command...",
  1609. # transformation_execute (pn_print)
  1610. "Which transformation do you want to execute?",
  1611. "Which model to bind for source type PetriNets",
  1612. set(['"p1" --> 1',
  1613. '"p2" --> 2',
  1614. '"p3" --> 3',
  1615. ]),
  1616. "Ready for command...",
  1617. # transformation_execute (pn_design_to_runtime)
  1618. "Which transformation do you want to execute?",
  1619. "Which model to bind for source type PetriNets",
  1620. "Which model to create for target type PetriNets_Runtime",
  1621. "Please perform manual operation \"pn_design_to_runtime\"",
  1622. "Model loaded, ready for commands!",
  1623. "Mode: r/w",
  1624. "Use 'help' command for a list of possible commands",
  1625. "Please give your command.",
  1626. # instantiate p1
  1627. "Type to instantiate?",
  1628. "Name of new element?",
  1629. "Instantiation successful!",
  1630. None,
  1631. "Please give your command.",
  1632. "Which element do you want to assign an attribute to?",
  1633. "Which attribute do you wish to assign?",
  1634. "Value of attribute?",
  1635. "Added attribute!",
  1636. "Please give your command.",
  1637. "Which element do you want to assign an attribute to?",
  1638. "Which attribute do you wish to assign?",
  1639. "Value of attribute?",
  1640. "Added attribute!",
  1641. "Please give your command.",
  1642. # instantiate p2
  1643. "Type to instantiate?",
  1644. "Name of new element?",
  1645. "Instantiation successful!",
  1646. None,
  1647. "Please give your command.",
  1648. "Which element do you want to assign an attribute to?",
  1649. "Which attribute do you wish to assign?",
  1650. "Value of attribute?",
  1651. "Added attribute!",
  1652. "Please give your command.",
  1653. "Which element do you want to assign an attribute to?",
  1654. "Which attribute do you wish to assign?",
  1655. "Value of attribute?",
  1656. "Added attribute!",
  1657. "Please give your command.",
  1658. # instantiate p3
  1659. "Type to instantiate?",
  1660. "Name of new element?",
  1661. "Instantiation successful!",
  1662. None,
  1663. "Please give your command.",
  1664. "Which element do you want to assign an attribute to?",
  1665. "Which attribute do you wish to assign?",
  1666. "Value of attribute?",
  1667. "Added attribute!",
  1668. "Please give your command.",
  1669. "Which element do you want to assign an attribute to?",
  1670. "Which attribute do you wish to assign?",
  1671. "Value of attribute?",
  1672. "Added attribute!",
  1673. "Please give your command.",
  1674. # instantiate t1
  1675. "Type to instantiate?",
  1676. "Name of new element?",
  1677. "Instantiation successful!",
  1678. None,
  1679. "Please give your command.",
  1680. "Which element do you want to assign an attribute to?",
  1681. "Which attribute do you wish to assign?",
  1682. "Value of attribute?",
  1683. "Added attribute!",
  1684. "Please give your command.",
  1685. # instantiate p2t1
  1686. "Type to instantiate?",
  1687. "Name of new element?",
  1688. "Source name?",
  1689. "Destination name?",
  1690. "Instantiation successful!",
  1691. None,
  1692. "Please give your command.",
  1693. "Which element do you want to assign an attribute to?",
  1694. "Which attribute do you wish to assign?",
  1695. "Value of attribute?",
  1696. "Added attribute!",
  1697. "Please give your command.",
  1698. # instantiate p2t2
  1699. "Type to instantiate?",
  1700. "Name of new element?",
  1701. "Source name?",
  1702. "Destination name?",
  1703. "Instantiation successful!",
  1704. None,
  1705. "Please give your command.",
  1706. "Which element do you want to assign an attribute to?",
  1707. "Which attribute do you wish to assign?",
  1708. "Value of attribute?",
  1709. "Added attribute!",
  1710. "Please give your command.",
  1711. # instantiate t2p1
  1712. "Type to instantiate?",
  1713. "Name of new element?",
  1714. "Source name?",
  1715. "Destination name?",
  1716. "Instantiation successful!",
  1717. None,
  1718. "Please give your command.",
  1719. "Which element do you want to assign an attribute to?",
  1720. "Which attribute do you wish to assign?",
  1721. "Value of attribute?",
  1722. "Added attribute!",
  1723. "Please give your command.",
  1724. "Ready for command...",
  1725. # transformation_execute (pn_step)
  1726. "Which transformation do you want to execute?",
  1727. "Which model to bind for source type PetriNets_Runtime",
  1728. "Which model to create for target type PetriNets_Runtime",
  1729. "Ready for command...",
  1730. # transformation_execute (pn_runtime_to_design)
  1731. "Which transformation do you want to execute?",
  1732. "Which model to bind for source type PetriNets_Runtime",
  1733. "Which model to create for target type PetriNets",
  1734. "Ready for command...",
  1735. # transformation_execute (pn_print)
  1736. "Which transformation do you want to execute?",
  1737. "Which model to bind for source type PetriNets",
  1738. set(['"p1" --> 0',
  1739. '"p2" --> 1',
  1740. '"p3" --> 5',
  1741. ]),
  1742. "Ready for command...",
  1743. ]))
  1744. def test_process_model_trivial_pn(self):
  1745. self.assertTrue(run_file(all_files,
  1746. [ "root", "root", "root",
  1747. "model_add",
  1748. "SimpleClassDiagrams",
  1749. "PetriNet",
  1750. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  1751. "model_add",
  1752. "SimpleClassDiagrams",
  1753. "ReachabilityGraph",
  1754. ] + get_model_constructor(open("integration/code/reachability_graph.mvc", "r").read()) + [
  1755. "model_list",
  1756. "transformation_add_MT_language",
  1757. "PetriNet",
  1758. "",
  1759. "PetriNet_RAM",
  1760. "transformation_add_MT_language",
  1761. "ReachabilityGraph",
  1762. "",
  1763. "ReachabilityGraph_RAM",
  1764. "transformation_add_MT",
  1765. "PetriNet_RAM",
  1766. "",
  1767. "PetriNet",
  1768. "",
  1769. "initialize_PN",
  1770. ] + get_model_constructor(open("integration/code/initialize_PN.mvc", "r").read()) + [
  1771. "transformation_add_MANUAL",
  1772. "PetriNet",
  1773. "",
  1774. "PetriNet",
  1775. "",
  1776. "refine_PN",
  1777. "transformation_add_AL",
  1778. "PetriNet",
  1779. "",
  1780. "ReachabilityGraph",
  1781. "",
  1782. "reachability",
  1783. ] + get_constructor(open("integration/code/reachability.alc", "r").read()) + [
  1784. "transformation_add_MT",
  1785. "ReachabilityGraph_RAM",
  1786. "ReachabilityGraph",
  1787. "",
  1788. "",
  1789. "reachability_print",
  1790. ] + get_model_constructor(open("integration/code/reachabilitygraph_print.mvc", "r").read()) + [
  1791. "model_add",
  1792. "ProcessModel",
  1793. "pn_reachability",
  1794. ] + get_model_constructor(open("integration/code/pm_pn_reachability.mvc", "r").read()) + [
  1795. "model_list",
  1796. "process_execute",
  1797. "pn_reachability",
  1798. "my_",
  1799. "instantiate",
  1800. "PetriNet/Place",
  1801. "p1",
  1802. "attr_add",
  1803. "p1",
  1804. "name",
  1805. "p1",
  1806. "attr_add",
  1807. "p1",
  1808. "tokens",
  1809. 1,
  1810. "instantiate",
  1811. "PetriNet/Transition",
  1812. "t1",
  1813. "attr_add",
  1814. "t1",
  1815. "name",
  1816. "t1",
  1817. "instantiate",
  1818. "PetriNet/P2T",
  1819. "p2t",
  1820. "p1",
  1821. "t1",
  1822. "attr_add",
  1823. "p2t",
  1824. "weight",
  1825. 1,
  1826. "exit",
  1827. "model_list",
  1828. ],
  1829. [ # bootup phase
  1830. "Desired username for admin user?",
  1831. "Desired password for admin user?",
  1832. "Please repeat the password",
  1833. "Passwords match!",
  1834. "Welcome to the Model Management Interface v2.0!",
  1835. "Use the 'help' command for a list of possible commands",
  1836. "Ready for command...",
  1837. # model_add
  1838. "Creating new model!",
  1839. "Model type?",
  1840. "Model name?",
  1841. "Waiting for model constructors...",
  1842. "Model upload success!",
  1843. "Ready for command...",
  1844. # model_add
  1845. "Creating new model!",
  1846. "Model type?",
  1847. "Model name?",
  1848. "Waiting for model constructors...",
  1849. "Model upload success!",
  1850. "Ready for command...",
  1851. # model_list
  1852. set(model_list) |
  1853. set([
  1854. " PetriNet : SimpleClassDiagrams",
  1855. " ReachabilityGraph : SimpleClassDiagrams",]),
  1856. "Ready for command...",
  1857. # transformation_add_MT_language
  1858. "Formalisms to include (terminate with empty string)?",
  1859. "Name of the RAMified transformation metamodel?",
  1860. "Ready for command...",
  1861. # transformation_add_MT_language
  1862. "Formalisms to include (terminate with empty string)?",
  1863. "Name of the RAMified transformation metamodel?",
  1864. "Ready for command...",
  1865. # transformation_add_MT
  1866. "RAMified metamodel to use?",
  1867. "Supported metamodels:",
  1868. set([" PetriNet",]),
  1869. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1870. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1871. "Name of new operation?",
  1872. "Waiting for model constructors...",
  1873. "Ready for command...",
  1874. # transformation_add_MANUAL
  1875. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1876. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1877. "Name of operation model?",
  1878. "Ready for command...",
  1879. # transformation_add_AL
  1880. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1881. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1882. "Name of operation model?",
  1883. "Waiting for model constructors...",
  1884. "Ready for command...",
  1885. # transformation_add_MT
  1886. "RAMified metamodel to use?",
  1887. "Supported metamodels:",
  1888. set([" ReachabilityGraph",]),
  1889. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1890. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1891. "Name of new operation?",
  1892. "Waiting for model constructors...",
  1893. "Ready for command...",
  1894. # model_add
  1895. "Creating new model!",
  1896. "Model type?",
  1897. "Model name?",
  1898. "Waiting for model constructors...",
  1899. "Model upload success!",
  1900. "Ready for command...",
  1901. # model_list
  1902. set(model_list) |
  1903. set([
  1904. " PetriNet : SimpleClassDiagrams",
  1905. " ReachabilityGraph : SimpleClassDiagrams",
  1906. " initialize_PN : PetriNet_RAM",
  1907. " refine_PN : ManualOperation",
  1908. " reachability : ActionLanguage",
  1909. " reachability_print : ReachabilityGraph_RAM",
  1910. " pn_reachability : ProcessModel",
  1911. " PetriNet_RAM : SimpleClassDiagrams",
  1912. " ReachabilityGraph_RAM : SimpleClassDiagrams",
  1913. " __merged_PetriNet_RAM : SimpleClassDiagrams",
  1914. " __merged_ReachabilityGraph_RAM : SimpleClassDiagrams",
  1915. " __merged_refine_PN : SimpleClassDiagrams",
  1916. " __merged_reachability : SimpleClassDiagrams",
  1917. ]),
  1918. "Ready for command...",
  1919. # process_execute
  1920. "Which process model do you want to execute?",
  1921. "Model prefix to use?",
  1922. "Please perform manual operation \"refine_PN\"",
  1923. "Model loaded, ready for commands!",
  1924. "Mode: r/w",
  1925. "Use 'help' command for a list of possible commands",
  1926. "Please give your command.",
  1927. # instantiate p1
  1928. "Type to instantiate?",
  1929. "Name of new element?",
  1930. "Instantiation successful!",
  1931. None,
  1932. "Please give your command.",
  1933. "Which element do you want to assign an attribute to?",
  1934. "Which attribute do you wish to assign?",
  1935. "Value of attribute?",
  1936. "Added attribute!",
  1937. "Please give your command.",
  1938. "Which element do you want to assign an attribute to?",
  1939. "Which attribute do you wish to assign?",
  1940. "Value of attribute?",
  1941. "Added attribute!",
  1942. "Please give your command.",
  1943. # instantiate t1
  1944. "Type to instantiate?",
  1945. "Name of new element?",
  1946. "Instantiation successful!",
  1947. None,
  1948. "Please give your command.",
  1949. "Which element do you want to assign an attribute to?",
  1950. "Which attribute do you wish to assign?",
  1951. "Value of attribute?",
  1952. "Added attribute!",
  1953. "Please give your command.",
  1954. # instantiate p2t
  1955. "Type to instantiate?",
  1956. "Name of new element?",
  1957. "Source name?",
  1958. "Destination name?",
  1959. "Instantiation successful!",
  1960. None,
  1961. "Please give your command.",
  1962. "Which element do you want to assign an attribute to?",
  1963. "Which attribute do you wish to assign?",
  1964. "Value of attribute?",
  1965. "Added attribute!",
  1966. "Please give your command.",
  1967. set(['"0": {"p1": 1, }',
  1968. '"1": {"p1": 0, }',
  1969. ]),
  1970. set(['"0" --["t1"]--> "1"',
  1971. ]),
  1972. "Ready for command...",
  1973. # model_list
  1974. set(model_list) |
  1975. set([
  1976. " PetriNet : SimpleClassDiagrams",
  1977. " ReachabilityGraph : SimpleClassDiagrams",
  1978. " initialize_PN : PetriNet_RAM",
  1979. " refine_PN : ManualOperation",
  1980. " reachability : ActionLanguage",
  1981. " reachability_print : ReachabilityGraph_RAM",
  1982. " pn_reachability : ProcessModel",
  1983. " PetriNet_RAM : SimpleClassDiagrams",
  1984. " ReachabilityGraph_RAM : SimpleClassDiagrams",
  1985. " my_pn : PetriNet",
  1986. " my_reachability : ReachabilityGraph",
  1987. " __merged_PetriNet_RAM : SimpleClassDiagrams",
  1988. " __merged_ReachabilityGraph_RAM : SimpleClassDiagrams",
  1989. " __merged_refine_PN : SimpleClassDiagrams",
  1990. " __merged_reachability : SimpleClassDiagrams",
  1991. ]),
  1992. "Ready for command...",
  1993. ]))
  1994. def test_render(self):
  1995. self.assertTrue(run_file(all_files,
  1996. [ "root", "root", "root",
  1997. "model_add",
  1998. "SimpleClassDiagrams",
  1999. "CausalBlockDiagrams",
  2000. ] + get_model_constructor(open("integration/code/cbd_design.mvc", "r").read()) + [
  2001. "model_add",
  2002. "SimpleClassDiagrams",
  2003. "MM_rendered_graphical",
  2004. ] + get_model_constructor(open("models/MM_rendered_graphical.mvc", "r").read()) + [
  2005. "model_add",
  2006. "CausalBlockDiagrams",
  2007. "my_CBD",
  2008. ] + get_model_constructor(open("integration/code/my_cbd.mvc", "r").read()) + [
  2009. "model_list",
  2010. "transformation_add_MT_language",
  2011. "CausalBlockDiagrams",
  2012. "MM_rendered_graphical",
  2013. "",
  2014. "CBD_RAM",
  2015. "model_modify",
  2016. "__merged_CBD_RAM",
  2017. "instantiate",
  2018. "Association",
  2019. "TracabilityLink",
  2020. "CausalBlockDiagrams/Block",
  2021. "MM_rendered_graphical/Group",
  2022. "exit",
  2023. "transformation_RAMify",
  2024. "__merged_CBD_RAM",
  2025. "CBD_RAM",
  2026. "transformation_add_MT",
  2027. "CBD_RAM",
  2028. "CausalBlockDiagrams",
  2029. "MM_rendered_graphical",
  2030. "",
  2031. "MM_rendered_graphical",
  2032. "",
  2033. "render_graphical_CBD",
  2034. ] + get_model_constructor(open("models/CBD_mapper.mvc", "r").read()) + [
  2035. "model_list",
  2036. "model_render",
  2037. "my_CBD",
  2038. "render_graphical_CBD",
  2039. ],
  2040. [ # bootup phase
  2041. "Desired username for admin user?",
  2042. "Desired password for admin user?",
  2043. "Please repeat the password",
  2044. "Passwords match!",
  2045. "Welcome to the Model Management Interface v2.0!",
  2046. "Use the 'help' command for a list of possible commands",
  2047. "Ready for command...",
  2048. # model_add
  2049. "Creating new model!",
  2050. "Model type?",
  2051. "Model name?",
  2052. "Waiting for model constructors...",
  2053. "Model upload success!",
  2054. "Ready for command...",
  2055. # model_add
  2056. "Creating new model!",
  2057. "Model type?",
  2058. "Model name?",
  2059. "Waiting for model constructors...",
  2060. "Model upload success!",
  2061. "Ready for command...",
  2062. # model_add
  2063. "Creating new model!",
  2064. "Model type?",
  2065. "Model name?",
  2066. "Waiting for model constructors...",
  2067. "Model upload success!",
  2068. "Ready for command...",
  2069. # model_list
  2070. set(model_list) |
  2071. set([
  2072. " CausalBlockDiagrams : SimpleClassDiagrams",
  2073. " MM_rendered_graphical : SimpleClassDiagrams",
  2074. " my_CBD : CausalBlockDiagrams",
  2075. ]),
  2076. "Ready for command...",
  2077. # transformation_add_MT_language
  2078. "Formalisms to include (terminate with empty string)?",
  2079. "Name of the RAMified transformation metamodel?",
  2080. "Ready for command...",
  2081. # model_modify
  2082. "Which model do you want to modify?",
  2083. "Model loaded, ready for commands!",
  2084. "Mode: r/w",
  2085. "Use 'help' command for a list of possible commands",
  2086. "Please give your command.",
  2087. # instantiate
  2088. "Type to instantiate?",
  2089. "Name of new element?",
  2090. "Source name?",
  2091. "Destination name?",
  2092. "Instantiation successful!",
  2093. None,
  2094. "Please give your command.",
  2095. "Ready for command...",
  2096. # transformation_RAMify
  2097. "Which metamodel do you want to RAMify?",
  2098. "Where do you want to store the RAMified metamodel?",
  2099. "Ready for command...",
  2100. # transformation_add_MT
  2101. "RAMified metamodel to use?",
  2102. "Supported metamodels:",
  2103. set([" CausalBlockDiagrams",
  2104. " MM_rendered_graphical",
  2105. ]),
  2106. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  2107. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  2108. "Name of new operation?",
  2109. "Waiting for model constructors...",
  2110. "Ready for command...",
  2111. # model_list
  2112. set(model_list) |
  2113. set([
  2114. " CausalBlockDiagrams : SimpleClassDiagrams",
  2115. " MM_rendered_graphical : SimpleClassDiagrams",
  2116. " CBD_RAM : SimpleClassDiagrams",
  2117. " my_CBD : CausalBlockDiagrams",
  2118. " render_graphical_CBD : CBD_RAM",
  2119. " __merged_CBD_RAM : SimpleClassDiagrams",
  2120. ]),
  2121. "Ready for command...",
  2122. # model_render
  2123. "Model to render?",
  2124. "Mapper to use?",
  2125. "Mapping success",
  2126. None,
  2127. ]))