test_mvc.py 94 KB

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