test_mvc.py 95 KB

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