test_mvc.py 91 KB

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