test_mvc.py 94 KB

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