test_mvc.py 91 KB

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