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. "primitives.alc",
  22. "object_operations.alc",
  23. "conformance_scd.alc",
  24. "library.alc",
  25. "transform.alc",
  26. "model_management.alc",
  27. "ramify.alc",
  28. "metamodels.alc",
  29. "random.alc",
  30. "constructors.alc",
  31. "modelling.alc",
  32. "compilation_manager.alc",
  33. ]
  34. class TestModelverseCore(unittest.TestCase):
  35. def test_list(self):
  36. self.assertTrue(run_file(all_files,
  37. [ "root", "root", "root",
  38. "model_list",
  39. ],
  40. [ "Desired username for admin user?",
  41. "Desired password for admin user?",
  42. "Please repeat the password",
  43. "Passwords match!",
  44. "Welcome to the Model Management Interface v2.0!",
  45. "Use the 'help' command for a list of possible commands",
  46. "Ready for command...",
  47. set(model_list),
  48. ]))
  49. def test_list_full(self):
  50. self.assertTrue(run_file(all_files,
  51. [ "root", "root", "root",
  52. "model_list_full",
  53. ],
  54. [ "Desired username for admin user?",
  55. "Desired password for admin user?",
  56. "Please repeat the password",
  57. "Passwords match!",
  58. "Welcome to the Model Management Interface v2.0!",
  59. "Use the 'help' command for a list of possible commands",
  60. "Ready for command...",
  61. set(model_full_list),
  62. ]))
  63. def test_model_add_empty(self):
  64. self.assertTrue(run_file(all_files,
  65. [ "root", "root", "root",
  66. "model_add",
  67. "SimpleClassDiagrams",
  68. "Empty",
  69. "exit",
  70. "model_list",
  71. "model_list_full",
  72. ],
  73. [ "Desired username for admin user?",
  74. "Desired password for admin user?",
  75. "Please repeat the password",
  76. "Passwords match!",
  77. "Welcome to the Model Management Interface v2.0!",
  78. "Use the 'help' command for a list of possible commands",
  79. "Ready for command...",
  80. "Creating new model!",
  81. "Model type?",
  82. "Model name?",
  83. "Waiting for model constructors...",
  84. "Model upload success!",
  85. "Ready for command...",
  86. set(model_list) |
  87. set([" Empty : SimpleClassDiagrams",]),
  88. "Ready for command...",
  89. set(model_full_list) |
  90. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  91. ]))
  92. def test_model_empty_modify(self):
  93. self.assertTrue(run_file(all_files,
  94. [ "root", "root", "root",
  95. "model_add",
  96. "SimpleClassDiagrams",
  97. "Empty",
  98. "exit",
  99. "model_list",
  100. "model_list_full",
  101. "model_modify",
  102. "Empty",
  103. "instantiate",
  104. "Class",
  105. "A",
  106. "exit",
  107. "model_list_full",
  108. ],
  109. [ "Desired username for admin user?",
  110. "Desired password for admin user?",
  111. "Please repeat the password",
  112. "Passwords match!",
  113. "Welcome to the Model Management Interface v2.0!",
  114. "Use the 'help' command for a list of possible commands",
  115. "Ready for command...",
  116. "Creating new model!",
  117. "Model type?",
  118. "Model name?",
  119. "Waiting for model constructors...",
  120. "Model upload success!",
  121. "Ready for command...",
  122. set(model_list) |
  123. set([" Empty : SimpleClassDiagrams",]),
  124. "Ready for command...",
  125. set(model_full_list) |
  126. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  127. "Ready for command...",
  128. "Which model do you want to modify?",
  129. "Model loaded, ready for commands!",
  130. "Use 'help' command for a list of possible commands",
  131. "Please give your command.",
  132. "Type to instantiate?",
  133. "Name of new element?",
  134. "Instantiation successful!",
  135. "Please give your command.",
  136. "Ready for command...",
  137. set(model_full_list) |
  138. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  139. "Ready for command...",
  140. ]))
  141. def test_model_overwrite(self):
  142. self.assertTrue(run_file(all_files,
  143. [ "root", "root", "root",
  144. "model_add",
  145. "SimpleClassDiagrams",
  146. "Empty",
  147. "exit",
  148. "model_list_full",
  149. "model_modify",
  150. "Empty",
  151. "instantiate",
  152. "Class",
  153. "A",
  154. "exit",
  155. "model_list_full",
  156. "model_overwrite",
  157. "Empty",
  158. "instantiate_node",
  159. "",
  160. "Class",
  161. "B",
  162. "instantiate_node",
  163. "",
  164. "Class",
  165. "C",
  166. "exit",
  167. "model_list_full",
  168. "model_modify",
  169. "Empty",
  170. "list",
  171. "exit",
  172. ],
  173. [ "Desired username for admin user?",
  174. "Desired password for admin user?",
  175. "Please repeat the password",
  176. "Passwords match!",
  177. "Welcome to the Model Management Interface v2.0!",
  178. "Use the 'help' command for a list of possible commands",
  179. "Ready for command...",
  180. "Creating new model!",
  181. "Model type?",
  182. "Model name?",
  183. "Waiting for model constructors...",
  184. "Model upload success!",
  185. "Ready for command...",
  186. set(model_full_list) |
  187. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  188. "Ready for command...",
  189. "Which model do you want to modify?",
  190. "Model loaded, ready for commands!",
  191. "Use 'help' command for a list of possible commands",
  192. "Please give your command.",
  193. "Type to instantiate?",
  194. "Name of new element?",
  195. "Instantiation successful!",
  196. "Please give your command.",
  197. "Ready for command...",
  198. set(model_full_list) |
  199. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  200. "Ready for command...",
  201. "Which model to overwrite?",
  202. "Waiting for model constructors...",
  203. "Model overwrite success!",
  204. "Ready for command...",
  205. set(model_full_list) |
  206. set([" 200 root nobody Empty : SimpleClassDiagrams",]),
  207. "Ready for command...",
  208. "Which model do you want to modify?",
  209. "Model loaded, ready for commands!",
  210. "Use 'help' command for a list of possible commands",
  211. "Please give your command.",
  212. "List of all elements:",
  213. set([" B : Class",
  214. " C : Class"]),
  215. "Please give your command.",
  216. "Ready for command...",
  217. ]))
  218. def test_transform_add_MT_language(self):
  219. self.assertTrue(run_file(all_files,
  220. [ "root", "root", "root",
  221. "model_add",
  222. "SimpleClassDiagrams",
  223. "PetriNets",
  224. ] + get_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
  225. "model_list_full",
  226. "transformation_add_MT_language",
  227. "PetriNets",
  228. "",
  229. "PetriNets_RAM",
  230. "model_list_full",
  231. ],
  232. [ "Desired username for admin user?",
  233. "Desired password for admin user?",
  234. "Please repeat the password",
  235. "Passwords match!",
  236. "Welcome to the Model Management Interface v2.0!",
  237. "Use the 'help' command for a list of possible commands",
  238. "Ready for command...",
  239. "Creating new model!",
  240. "Model type?",
  241. "Model name?",
  242. "Waiting for model constructors...",
  243. "Model upload success!",
  244. "Ready for command...",
  245. set(model_full_list) |
  246. set([" 200 root nobody PetriNets : SimpleClassDiagrams",]),
  247. "Ready for command...",
  248. "Formalisms to include (terminate with empty string)?",
  249. "Name of the RAMified transformation metamodel?",
  250. "Ready for command...",
  251. set(model_full_list) |
  252. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  253. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  254. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",]),
  255. "Ready for command...",
  256. ]))
  257. def test_transform_add_MT_instance(self):
  258. self.assertTrue(run_file(all_files,
  259. [ "root", "root", "root",
  260. "model_add",
  261. "SimpleClassDiagrams",
  262. "PetriNets",
  263. ] + get_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
  264. "model_list_full",
  265. "transformation_add_MT_language",
  266. "PetriNets",
  267. "",
  268. "PetriNets_RAM",
  269. "model_list_full",
  270. "transformation_add_MT",
  271. "PetriNets_RAM",
  272. "PetriNets",
  273. "",
  274. "",
  275. "PetriNets_Print",
  276. "exit",
  277. "model_list_full",
  278. "transformation_list",
  279. "transformation_list_full",
  280. ],
  281. [ "Desired username for admin user?",
  282. "Desired password for admin user?",
  283. "Please repeat the password",
  284. "Passwords match!",
  285. "Welcome to the Model Management Interface v2.0!",
  286. "Use the 'help' command for a list of possible commands",
  287. "Ready for command...",
  288. "Creating new model!",
  289. "Model type?",
  290. "Model name?",
  291. "Waiting for model constructors...",
  292. "Model upload success!",
  293. "Ready for command...",
  294. set(model_full_list) |
  295. set([" 200 root nobody PetriNets : SimpleClassDiagrams",]),
  296. "Ready for command...",
  297. "Formalisms to include (terminate with empty string)?",
  298. "Name of the RAMified transformation metamodel?",
  299. "Ready for command...",
  300. set(model_full_list) |
  301. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  302. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  303. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",]),
  304. "Ready for command...",
  305. "RAMified metamodel to use?",
  306. "Supported metamodels:",
  307. set([" PetriNets",
  308. ]),
  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. "",
  379. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  380. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  381. "Name of new operation?",
  382. "Waiting for model constructors...",
  383. "Ready for command...",
  384. set([" 200 root nobody [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  385. ]),
  386. "Ready for command...",
  387. ]))
  388. def test_transform_add_MT_pn_print_exec(self):
  389. self.assertTrue(run_file(all_files,
  390. [ "root", "root", "root",
  391. "model_add",
  392. "SimpleClassDiagrams",
  393. "PetriNets",
  394. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  395. "model_add",
  396. "PetriNets",
  397. "my_pn",
  398. ] + get_model_constructor(open("integration/code/pn_runtime_model.mvc", "r").read()) + [
  399. "model_list_full",
  400. "transformation_add_MT_language",
  401. "PetriNets",
  402. "",
  403. "PetriNets_RAM",
  404. "model_list_full",
  405. "transformation_add_MT",
  406. "PetriNets_RAM",
  407. "PetriNets",
  408. "",
  409. "",
  410. "PetriNets_Print",
  411. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  412. "transformation_list_full",
  413. "transformation_execute",
  414. "PetriNets_Print",
  415. "my_pn",
  416. "transformation_list_full",
  417. ],
  418. [ "Desired username for admin user?",
  419. "Desired password for admin user?",
  420. "Please repeat the password",
  421. "Passwords match!",
  422. "Welcome to the Model Management Interface v2.0!",
  423. "Use the 'help' command for a list of possible commands",
  424. "Ready for command...",
  425. "Creating new model!",
  426. "Model type?",
  427. "Model name?",
  428. "Waiting for model constructors...",
  429. "Model upload success!",
  430. "Ready for command...",
  431. "Creating new model!",
  432. "Model type?",
  433. "Model name?",
  434. "Waiting for model constructors...",
  435. "Model upload success!",
  436. "Ready for command...",
  437. set(model_full_list) |
  438. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  439. " 200 root nobody my_pn : PetriNets",]),
  440. "Ready for command...",
  441. "Formalisms to include (terminate with empty string)?",
  442. "Name of the RAMified transformation metamodel?",
  443. "Ready for command...",
  444. set(model_full_list) |
  445. set([" 200 root nobody PetriNets : SimpleClassDiagrams",
  446. " 200 root nobody __merged_PetriNets_RAM : SimpleClassDiagrams",
  447. " 200 root nobody PetriNets_RAM : SimpleClassDiagrams",
  448. " 200 root nobody my_pn : PetriNets",]),
  449. "Ready for command...",
  450. "RAMified metamodel to use?",
  451. "Supported metamodels:",
  452. set([" PetriNets",
  453. ]),
  454. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  455. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  456. "Name of new operation?",
  457. "Waiting for model constructors...",
  458. "Ready for command...",
  459. set([" 200 root nobody [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  460. ]),
  461. "Ready for command...",
  462. "Which transformation do you want to execute?",
  463. "Which model to bind for source type PetriNets",
  464. set(['"p1" --> 1',
  465. '"p2" --> 2',
  466. '"p3" --> 3',
  467. ]),
  468. "Ready for command...",
  469. ]))
  470. def test_transform_add_MT_pn_simulate(self):
  471. """
  472. 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.
  473. First, Petri net metamodels are created for both the design language and the runtime language.
  474. Both languages only differ marginally from each other, with the runtime language only adding information on the currently selected transition for execution.
  475. Afterwards, a trivial Petri net model is created in the design language.
  476. This part tests the domain-specific and meta-modelling concepts of the Modelverse.
  477. After all models are created, transformations are defined to map between both languages: from design to runtime, and vice versa.
  478. Additional transformations are created for in-place model simulation and the printing of a Petri net model.
  479. This tests the modification of models, through the use of model transformations.
  480. Due to the use of a separate design and runtime language, we test exogenous transformations.
  481. The simulation transformation takes a single step in the Petri net model, by firing one of the applicable transitions, and therefore tests endogenous transformations.
  482. """
  483. self.assertTrue(run_file(all_files,
  484. [ "root", "root", "root",
  485. "model_add",
  486. "SimpleClassDiagrams",
  487. "PetriNets",
  488. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  489. "model_add",
  490. "SimpleClassDiagrams",
  491. "PetriNets_Runtime",
  492. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  493. "model_add",
  494. "PetriNets",
  495. "my_pn",
  496. ] + get_model_constructor(open("integration/code/pn_design_model.mvc", "r").read()) + [
  497. "model_list",
  498. "transformation_add_MT_language",
  499. "PetriNets_Runtime",
  500. "PetriNets",
  501. "",
  502. "PetriNets_RAM",
  503. "model_list",
  504. "model_modify",
  505. "__merged_PetriNets_RAM",
  506. "instantiate",
  507. "Association",
  508. "D2R_PlaceLink",
  509. "PetriNets/Place",
  510. "PetriNets_Runtime/Place",
  511. "instantiate",
  512. "Association",
  513. "D2R_TransitionLink",
  514. "PetriNets/Transition",
  515. "PetriNets_Runtime/Transition",
  516. "instantiate",
  517. "Association",
  518. "R2D_PlaceLink",
  519. "PetriNets_Runtime/Place",
  520. "PetriNets/Place",
  521. "instantiate",
  522. "Association",
  523. "R2D_TransitionLink",
  524. "PetriNets_Runtime/Transition",
  525. "PetriNets/Transition",
  526. "exit",
  527. "transformation_RAMify",
  528. "__merged_PetriNets_RAM",
  529. "PetriNets_RAM",
  530. "transformation_add_MT",
  531. "PetriNets_RAM",
  532. "PetriNets",
  533. "",
  534. "PetriNets_Runtime",
  535. "",
  536. "pn_design_to_runtime",
  537. ] + get_model_constructor(open("integration/code/pn_design_to_runtime.mvc", "r").read()) + [
  538. "transformation_add_MT",
  539. "PetriNets_RAM",
  540. "PetriNets_Runtime",
  541. "",
  542. "PetriNets",
  543. "",
  544. "pn_runtime_to_design",
  545. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  546. "transformation_add_MT",
  547. "PetriNets_RAM",
  548. "PetriNets_Runtime",
  549. "",
  550. "PetriNets_Runtime",
  551. "",
  552. "pn_step",
  553. ] + get_model_constructor(open("integration/code/pn_simulate.mvc", "r").read()) + [
  554. "transformation_add_MT",
  555. "PetriNets_RAM",
  556. "PetriNets",
  557. "",
  558. "",
  559. "pn_print",
  560. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  561. "model_list",
  562. "transformation_list",
  563. "transformation_execute",
  564. "pn_print",
  565. "my_pn",
  566. "transformation_execute",
  567. "pn_design_to_runtime",
  568. "my_pn",
  569. "my_pn_runtime",
  570. "transformation_execute",
  571. "pn_step",
  572. "my_pn_runtime",
  573. "my_pn_runtime",
  574. "transformation_execute",
  575. "pn_runtime_to_design",
  576. "my_pn_runtime",
  577. "my_pn",
  578. "transformation_execute",
  579. "pn_print",
  580. "my_pn",
  581. ],
  582. [ # bootup phase
  583. "Desired username for admin user?",
  584. "Desired password for admin user?",
  585. "Please repeat the password",
  586. "Passwords match!",
  587. "Welcome to the Model Management Interface v2.0!",
  588. "Use the 'help' command for a list of possible commands",
  589. "Ready for command...",
  590. # model_add
  591. "Creating new model!",
  592. "Model type?",
  593. "Model name?",
  594. "Waiting for model constructors...",
  595. "Model upload success!",
  596. "Ready for command...",
  597. # model_add
  598. "Creating new model!",
  599. "Model type?",
  600. "Model name?",
  601. "Waiting for model constructors...",
  602. "Model upload success!",
  603. "Ready for command...",
  604. # model_add
  605. "Creating new model!",
  606. "Model type?",
  607. "Model name?",
  608. "Waiting for model constructors...",
  609. "Model upload success!",
  610. "Ready for command...",
  611. # model_list
  612. set(model_list) |
  613. set([
  614. " PetriNets : SimpleClassDiagrams",
  615. " my_pn : PetriNets",
  616. " PetriNets_Runtime : SimpleClassDiagrams",]),
  617. "Ready for command...",
  618. # transformation_add_MT_language
  619. "Formalisms to include (terminate with empty string)?",
  620. "Name of the RAMified transformation metamodel?",
  621. "Ready for command...",
  622. # model_list
  623. set(model_list) |
  624. set([
  625. " PetriNets : SimpleClassDiagrams",
  626. " my_pn : PetriNets",
  627. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  628. " PetriNets_RAM : SimpleClassDiagrams",
  629. " PetriNets_Runtime : SimpleClassDiagrams",]),
  630. "Ready for command...",
  631. # model_modify
  632. "Which model do you want to modify?",
  633. "Model loaded, ready for commands!",
  634. "Use 'help' command for a list of possible commands",
  635. "Please give your command.",
  636. # instantiate 1
  637. "Type to instantiate?",
  638. "Name of new element?",
  639. "Source name?",
  640. "Destination name?",
  641. "Instantiation successful!",
  642. "Please give your command.",
  643. # instantiate 2
  644. "Type to instantiate?",
  645. "Name of new element?",
  646. "Source name?",
  647. "Destination name?",
  648. "Instantiation successful!",
  649. "Please give your command.",
  650. # instantiate 3
  651. "Type to instantiate?",
  652. "Name of new element?",
  653. "Source name?",
  654. "Destination name?",
  655. "Instantiation successful!",
  656. "Please give your command.",
  657. # instantiate 4
  658. "Type to instantiate?",
  659. "Name of new element?",
  660. "Source name?",
  661. "Destination name?",
  662. "Instantiation successful!",
  663. "Please give your command.",
  664. "Ready for command...",
  665. # transformation_RAMify
  666. "Which metamodel do you want to RAMify?",
  667. "Where do you want to store the RAMified metamodel?",
  668. "Ready for command...",
  669. # transformation_add_MT
  670. "RAMified metamodel to use?",
  671. "Supported metamodels:",
  672. set([" PetriNets",
  673. " PetriNets_Runtime",
  674. ]),
  675. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  676. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  677. "Name of new operation?",
  678. "Waiting for model constructors...",
  679. "Ready for command...",
  680. # transformation_add_MT
  681. "RAMified metamodel to use?",
  682. "Supported metamodels:",
  683. set([" PetriNets",
  684. " PetriNets_Runtime",
  685. ]),
  686. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  687. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  688. "Name of new operation?",
  689. "Waiting for model constructors...",
  690. "Ready for command...",
  691. # transformation_add_MT
  692. "RAMified metamodel to use?",
  693. "Supported metamodels:",
  694. set([" PetriNets",
  695. " PetriNets_Runtime",
  696. ]),
  697. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  698. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  699. "Name of new operation?",
  700. "Waiting for model constructors...",
  701. "Ready for command...",
  702. # transformation_add_MT
  703. "RAMified metamodel to use?",
  704. "Supported metamodels:",
  705. set([" PetriNets",
  706. " PetriNets_Runtime",
  707. ]),
  708. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  709. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  710. "Name of new operation?",
  711. "Waiting for model constructors...",
  712. "Ready for command...",
  713. # model_list
  714. set(model_list) |
  715. set([
  716. " PetriNets : SimpleClassDiagrams",
  717. " my_pn : PetriNets",
  718. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  719. " PetriNets_RAM : SimpleClassDiagrams",
  720. " pn_print : PetriNets_RAM",
  721. " pn_design_to_runtime : PetriNets_RAM",
  722. " pn_runtime_to_design : PetriNets_RAM",
  723. " pn_step : PetriNets_RAM",
  724. " PetriNets_Runtime : SimpleClassDiagrams",]),
  725. "Ready for command...",
  726. # transformation_list
  727. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  728. "[ModelTransformation] pn_design_to_runtime : PetriNets_RAM",
  729. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  730. "[ModelTransformation] pn_step : PetriNets_RAM"]),
  731. "Ready for command...",
  732. # transformation_execute (pn_print)
  733. "Which transformation do you want to execute?",
  734. "Which model to bind for source type PetriNets",
  735. set(['"p1" --> 1',
  736. '"p2" --> 2',
  737. '"p3" --> 3',
  738. ]),
  739. "Ready for command...",
  740. # transformation_execute (pn_design_to_runtime)
  741. "Which transformation do you want to execute?",
  742. "Which model to bind for source type PetriNets",
  743. "Which model to create for target type PetriNets_Runtime",
  744. "Ready for command...",
  745. # transformation_execute (pn_step)
  746. "Which transformation do you want to execute?",
  747. "Which model to bind for source type PetriNets_Runtime",
  748. "Which model to create for target type PetriNets_Runtime",
  749. "Ready for command...",
  750. # transformation_execute (pn_runtime_to_design)
  751. "Which transformation do you want to execute?",
  752. "Which model to bind for source type PetriNets_Runtime",
  753. "Which model to create for target type PetriNets",
  754. "Ready for command...",
  755. # transformation_execute (pn_print)
  756. "Which transformation do you want to execute?",
  757. "Which model to bind for source type PetriNets",
  758. set(['"p1" --> 0',
  759. '"p2" --> 1',
  760. '"p3" --> 5',
  761. ]),
  762. "Ready for command...",
  763. ]))
  764. @slow
  765. def test_transform_add_MT_pn_simulate_larger(self):
  766. def step_and_print():
  767. return [ \
  768. # transformation_execute (pn_step)
  769. "Which transformation do you want to execute?",
  770. "Which model to bind for source type PetriNets_Runtime",
  771. "Which model to create for target type PetriNets_Runtime",
  772. "Ready for command...",
  773. # transformation_execute (pn_runtime_to_design)
  774. "Which transformation do you want to execute?",
  775. "Which model to bind for source type PetriNets_Runtime",
  776. "Which model to create for target type PetriNets",
  777. "Ready for command...",
  778. # transformation_execute (pn_print)
  779. "Which transformation do you want to execute?",
  780. "Which model to bind for source type PetriNets",
  781. None,
  782. None,
  783. None,
  784. "Ready for command...",
  785. ]
  786. self.assertTrue(run_file(all_files,
  787. [ "root", "root", "root",
  788. "model_add",
  789. "SimpleClassDiagrams",
  790. "PetriNets",
  791. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  792. "model_add",
  793. "SimpleClassDiagrams",
  794. "PetriNets_Runtime",
  795. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  796. "model_add",
  797. "PetriNets",
  798. "my_pn",
  799. ] + get_model_constructor(open("integration/code/pn_design_model_larger.mvc", "r").read()) + [
  800. "model_list",
  801. "transformation_add_MT_language",
  802. "PetriNets_Runtime",
  803. "PetriNets",
  804. "",
  805. "PetriNets_RAM",
  806. "model_list",
  807. "model_modify",
  808. "__merged_PetriNets_RAM",
  809. "instantiate",
  810. "Association",
  811. "D2R_PlaceLink",
  812. "PetriNets/Place",
  813. "PetriNets_Runtime/Place",
  814. "instantiate",
  815. "Association",
  816. "D2R_TransitionLink",
  817. "PetriNets/Transition",
  818. "PetriNets_Runtime/Transition",
  819. "instantiate",
  820. "Association",
  821. "R2D_PlaceLink",
  822. "PetriNets_Runtime/Place",
  823. "PetriNets/Place",
  824. "instantiate",
  825. "Association",
  826. "R2D_TransitionLink",
  827. "PetriNets_Runtime/Transition",
  828. "PetriNets/Transition",
  829. "exit",
  830. "transformation_RAMify",
  831. "__merged_PetriNets_RAM",
  832. "PetriNets_RAM",
  833. "transformation_add_MT",
  834. "PetriNets_RAM",
  835. "PetriNets",
  836. "",
  837. "PetriNets_Runtime",
  838. "",
  839. "pn_design_to_runtime",
  840. ] + get_model_constructor(open("integration/code/pn_design_to_runtime.mvc", "r").read()) + [
  841. "transformation_add_MT",
  842. "PetriNets_RAM",
  843. "PetriNets_Runtime",
  844. "",
  845. "PetriNets",
  846. "",
  847. "pn_runtime_to_design",
  848. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  849. "transformation_add_MT",
  850. "PetriNets_RAM",
  851. "PetriNets_Runtime",
  852. "",
  853. "PetriNets_Runtime",
  854. "",
  855. "pn_step",
  856. ] + get_model_constructor(open("integration/code/pn_simulate.mvc", "r").read()) + [
  857. "transformation_add_MT",
  858. "PetriNets_RAM",
  859. "PetriNets",
  860. "",
  861. "",
  862. "pn_print",
  863. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  864. "model_list",
  865. "transformation_list",
  866. "transformation_execute",
  867. "pn_print",
  868. "my_pn",
  869. "transformation_execute",
  870. "pn_design_to_runtime",
  871. "my_pn",
  872. "my_pn_runtime", ] + [
  873. "transformation_execute",
  874. "pn_step",
  875. "my_pn_runtime",
  876. "my_pn_runtime",
  877. "transformation_execute",
  878. "pn_runtime_to_design",
  879. "my_pn_runtime",
  880. "my_pn",
  881. "transformation_execute",
  882. "pn_print",
  883. "my_pn",
  884. ] * 10 + [
  885. ],
  886. [ # bootup phase
  887. "Desired username for admin user?",
  888. "Desired password for admin user?",
  889. "Please repeat the password",
  890. "Passwords match!",
  891. "Welcome to the Model Management Interface v2.0!",
  892. "Use the 'help' command for a list of possible commands",
  893. "Ready for command...",
  894. # model_add
  895. "Creating new model!",
  896. "Model type?",
  897. "Model name?",
  898. "Waiting for model constructors...",
  899. "Model upload success!",
  900. "Ready for command...",
  901. # model_add
  902. "Creating new model!",
  903. "Model type?",
  904. "Model name?",
  905. "Waiting for model constructors...",
  906. "Model upload success!",
  907. "Ready for command...",
  908. # model_add
  909. "Creating new model!",
  910. "Model type?",
  911. "Model name?",
  912. "Waiting for model constructors...",
  913. "Model upload success!",
  914. "Ready for command...",
  915. # model_list
  916. set(model_list) |
  917. set([
  918. " PetriNets : SimpleClassDiagrams",
  919. " my_pn : PetriNets",
  920. " PetriNets_Runtime : SimpleClassDiagrams",]),
  921. "Ready for command...",
  922. # transformation_add_MT_language
  923. "Formalisms to include (terminate with empty string)?",
  924. "Name of the RAMified transformation metamodel?",
  925. "Ready for command...",
  926. # model_list
  927. set(model_list) |
  928. set([
  929. " PetriNets : SimpleClassDiagrams",
  930. " my_pn : PetriNets",
  931. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  932. " PetriNets_RAM : SimpleClassDiagrams",
  933. " PetriNets_Runtime : SimpleClassDiagrams",]),
  934. "Ready for command...",
  935. # model_modify
  936. "Which model do you want to modify?",
  937. "Model loaded, ready for commands!",
  938. "Use 'help' command for a list of possible commands",
  939. "Please give your command.",
  940. # instantiate 1
  941. "Type to instantiate?",
  942. "Name of new element?",
  943. "Source name?",
  944. "Destination name?",
  945. "Instantiation successful!",
  946. "Please give your command.",
  947. # instantiate 2
  948. "Type to instantiate?",
  949. "Name of new element?",
  950. "Source name?",
  951. "Destination name?",
  952. "Instantiation successful!",
  953. "Please give your command.",
  954. # instantiate 3
  955. "Type to instantiate?",
  956. "Name of new element?",
  957. "Source name?",
  958. "Destination name?",
  959. "Instantiation successful!",
  960. "Please give your command.",
  961. # instantiate 4
  962. "Type to instantiate?",
  963. "Name of new element?",
  964. "Source name?",
  965. "Destination name?",
  966. "Instantiation successful!",
  967. "Please give your command.",
  968. "Ready for command...",
  969. # transformation_RAMify
  970. "Which metamodel do you want to RAMify?",
  971. "Where do you want to store the RAMified metamodel?",
  972. "Ready for command...",
  973. # transformation_add_MT
  974. "RAMified metamodel to use?",
  975. "Supported metamodels:",
  976. set([" PetriNets",
  977. " PetriNets_Runtime",
  978. ]),
  979. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  980. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  981. "Name of new operation?",
  982. "Waiting for model constructors...",
  983. "Ready for command...",
  984. # transformation_add_MT
  985. "RAMified metamodel to use?",
  986. "Supported metamodels:",
  987. set([" PetriNets",
  988. " PetriNets_Runtime",
  989. ]),
  990. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  991. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  992. "Name of new operation?",
  993. "Waiting for model constructors...",
  994. "Ready for command...",
  995. # transformation_add_MT
  996. "RAMified metamodel to use?",
  997. "Supported metamodels:",
  998. set([" PetriNets",
  999. " PetriNets_Runtime",
  1000. ]),
  1001. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1002. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1003. "Name of new operation?",
  1004. "Waiting for model constructors...",
  1005. "Ready for command...",
  1006. # transformation_add_MT
  1007. "RAMified metamodel to use?",
  1008. "Supported metamodels:",
  1009. set([" PetriNets",
  1010. " PetriNets_Runtime",
  1011. ]),
  1012. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1013. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1014. "Name of new operation?",
  1015. "Waiting for model constructors...",
  1016. "Ready for command...",
  1017. # model_list
  1018. set(model_list) |
  1019. set([
  1020. " PetriNets : SimpleClassDiagrams",
  1021. " my_pn : PetriNets",
  1022. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1023. " PetriNets_RAM : SimpleClassDiagrams",
  1024. " pn_print : PetriNets_RAM",
  1025. " pn_design_to_runtime : PetriNets_RAM",
  1026. " pn_runtime_to_design : PetriNets_RAM",
  1027. " pn_step : PetriNets_RAM",
  1028. " PetriNets_Runtime : SimpleClassDiagrams",]),
  1029. "Ready for command...",
  1030. # transformation_list
  1031. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  1032. "[ModelTransformation] pn_design_to_runtime : PetriNets_RAM",
  1033. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  1034. "[ModelTransformation] pn_step : PetriNets_RAM"]),
  1035. "Ready for command...",
  1036. # transformation_execute (pn_print)
  1037. "Which transformation do you want to execute?",
  1038. "Which model to bind for source type PetriNets",
  1039. set(['"lock_available" --> 1',
  1040. '"critical_section_1" --> 0',
  1041. '"critical_section_2" --> 0',
  1042. ]),
  1043. "Ready for command...",
  1044. # transformation_execute (pn_design_to_runtime)
  1045. "Which transformation do you want to execute?",
  1046. "Which model to bind for source type PetriNets",
  1047. "Which model to create for target type PetriNets_Runtime",
  1048. "Ready for command...",
  1049. ] + \
  1050. step_and_print() * 10 +
  1051. []))
  1052. def test_transform_add_AL_pn_simulate(self):
  1053. self.assertTrue(run_file(all_files,
  1054. [ "root", "root", "root",
  1055. "model_add",
  1056. "SimpleClassDiagrams",
  1057. "PetriNets",
  1058. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  1059. "model_add",
  1060. "SimpleClassDiagrams",
  1061. "PetriNets_Runtime",
  1062. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  1063. "model_add",
  1064. "PetriNets",
  1065. "my_pn",
  1066. ] + get_model_constructor(open("integration/code/pn_design_model.mvc", "r").read()) + [
  1067. "model_list",
  1068. "transformation_add_MT_language",
  1069. "PetriNets_Runtime",
  1070. "PetriNets",
  1071. "",
  1072. "PetriNets_RAM",
  1073. "model_list",
  1074. "model_modify",
  1075. "__merged_PetriNets_RAM",
  1076. "instantiate",
  1077. "Association",
  1078. "D2R_PlaceLink",
  1079. "PetriNets/Place",
  1080. "PetriNets_Runtime/Place",
  1081. "instantiate",
  1082. "Association",
  1083. "D2R_TransitionLink",
  1084. "PetriNets/Transition",
  1085. "PetriNets_Runtime/Transition",
  1086. "instantiate",
  1087. "Association",
  1088. "R2D_PlaceLink",
  1089. "PetriNets_Runtime/Place",
  1090. "PetriNets/Place",
  1091. "instantiate",
  1092. "Association",
  1093. "R2D_TransitionLink",
  1094. "PetriNets_Runtime/Transition",
  1095. "PetriNets/Transition",
  1096. "exit",
  1097. "transformation_RAMify",
  1098. "__merged_PetriNets_RAM",
  1099. "PetriNets_RAM",
  1100. "transformation_add_MT",
  1101. "PetriNets_RAM",
  1102. "PetriNets",
  1103. "",
  1104. "PetriNets_Runtime",
  1105. "",
  1106. "pn_design_to_runtime",
  1107. ] + get_model_constructor(open("integration/code/pn_design_to_runtime.mvc", "r").read()) + [
  1108. "transformation_add_MT",
  1109. "PetriNets_RAM",
  1110. "PetriNets_Runtime",
  1111. "",
  1112. "PetriNets",
  1113. "",
  1114. "pn_runtime_to_design",
  1115. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  1116. "transformation_add_AL",
  1117. "PetriNets_Runtime",
  1118. "",
  1119. "PetriNets_Runtime",
  1120. "",
  1121. "pn_step",
  1122. ] + get_constructor(open("integration/code/pn_simulate.alc", "r").read()) + [
  1123. "transformation_add_MT",
  1124. "PetriNets_RAM",
  1125. "PetriNets",
  1126. "",
  1127. "",
  1128. "pn_print",
  1129. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  1130. "model_list",
  1131. "transformation_list",
  1132. "transformation_execute",
  1133. "pn_print",
  1134. "my_pn",
  1135. "transformation_execute",
  1136. "pn_design_to_runtime",
  1137. "my_pn",
  1138. "my_pn_runtime",
  1139. "transformation_execute",
  1140. "pn_step",
  1141. "my_pn_runtime",
  1142. "my_pn_runtime",
  1143. "transformation_execute",
  1144. "pn_runtime_to_design",
  1145. "my_pn_runtime",
  1146. "my_pn",
  1147. "transformation_execute",
  1148. "pn_print",
  1149. "my_pn",
  1150. ],
  1151. [ # bootup phase
  1152. "Desired username for admin user?",
  1153. "Desired password for admin user?",
  1154. "Please repeat the password",
  1155. "Passwords match!",
  1156. "Welcome to the Model Management Interface v2.0!",
  1157. "Use the 'help' command for a list of possible commands",
  1158. "Ready for command...",
  1159. # model_add
  1160. "Creating new model!",
  1161. "Model type?",
  1162. "Model name?",
  1163. "Waiting for model constructors...",
  1164. "Model upload success!",
  1165. "Ready for command...",
  1166. # model_add
  1167. "Creating new model!",
  1168. "Model type?",
  1169. "Model name?",
  1170. "Waiting for model constructors...",
  1171. "Model upload success!",
  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_list
  1181. set(model_list) |
  1182. set([" PetriNets : SimpleClassDiagrams",
  1183. " my_pn : PetriNets",
  1184. " PetriNets_Runtime : SimpleClassDiagrams",]),
  1185. "Ready for command...",
  1186. # transformation_add_MT_language
  1187. "Formalisms to include (terminate with empty string)?",
  1188. "Name of the RAMified transformation metamodel?",
  1189. "Ready for command...",
  1190. # model_list
  1191. set(model_list) |
  1192. set([
  1193. " PetriNets_Runtime : SimpleClassDiagrams",
  1194. " PetriNets : SimpleClassDiagrams",
  1195. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1196. " PetriNets_RAM : SimpleClassDiagrams",
  1197. " my_pn : PetriNets",]),
  1198. "Ready for command...",
  1199. # model_modify
  1200. "Which model do you want to modify?",
  1201. "Model loaded, ready for commands!",
  1202. "Use 'help' command for a list of possible commands",
  1203. "Please give your command.",
  1204. # instantiate 1
  1205. "Type to instantiate?",
  1206. "Name of new element?",
  1207. "Source name?",
  1208. "Destination name?",
  1209. "Instantiation successful!",
  1210. "Please give your command.",
  1211. # instantiate 2
  1212. "Type to instantiate?",
  1213. "Name of new element?",
  1214. "Source name?",
  1215. "Destination name?",
  1216. "Instantiation successful!",
  1217. "Please give your command.",
  1218. # instantiate 3
  1219. "Type to instantiate?",
  1220. "Name of new element?",
  1221. "Source name?",
  1222. "Destination name?",
  1223. "Instantiation successful!",
  1224. "Please give your command.",
  1225. # instantiate 4
  1226. "Type to instantiate?",
  1227. "Name of new element?",
  1228. "Source name?",
  1229. "Destination name?",
  1230. "Instantiation successful!",
  1231. "Please give your command.",
  1232. "Ready for command...",
  1233. # transformation_RAMify
  1234. "Which metamodel do you want to RAMify?",
  1235. "Where do you want to store the RAMified metamodel?",
  1236. "Ready for command...",
  1237. # transformation_add_MT
  1238. "RAMified metamodel to use?",
  1239. "Supported metamodels:",
  1240. set([" PetriNets",
  1241. " PetriNets_Runtime",
  1242. ]),
  1243. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1244. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1245. "Name of new operation?",
  1246. "Waiting for model constructors...",
  1247. "Ready for command...",
  1248. # transformation_add_MT
  1249. "RAMified metamodel to use?",
  1250. "Supported metamodels:",
  1251. set([" PetriNets",
  1252. " PetriNets_Runtime",
  1253. ]),
  1254. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1255. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1256. "Name of new operation?",
  1257. "Waiting for model constructors...",
  1258. "Ready for command...",
  1259. # transformation_add_AL
  1260. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1261. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1262. "Name of operation model?",
  1263. "Waiting for model constructors...",
  1264. "Ready for command...",
  1265. # transformation_add_MT
  1266. "RAMified metamodel to use?",
  1267. "Supported metamodels:",
  1268. set([" PetriNets",
  1269. " PetriNets_Runtime",
  1270. ]),
  1271. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1272. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1273. "Name of new operation?",
  1274. "Waiting for model constructors...",
  1275. "Ready for command...",
  1276. # model_list
  1277. set(model_list) |
  1278. set([
  1279. " PetriNets_Runtime : SimpleClassDiagrams",
  1280. " PetriNets : SimpleClassDiagrams",
  1281. " pn_print : PetriNets_RAM",
  1282. " pn_design_to_runtime : PetriNets_RAM",
  1283. " pn_runtime_to_design : PetriNets_RAM",
  1284. " pn_step : ActionLanguage",
  1285. " __merged_pn_step : SimpleClassDiagrams",
  1286. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1287. " PetriNets_RAM : SimpleClassDiagrams",
  1288. " my_pn : PetriNets",]),
  1289. "Ready for command...",
  1290. # transformation_list
  1291. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  1292. "[ModelTransformation] pn_design_to_runtime : PetriNets_RAM",
  1293. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  1294. "[ActionLanguage] pn_step : ActionLanguage"]),
  1295. "Ready for command...",
  1296. # transformation_execute (pn_print)
  1297. "Which transformation do you want to execute?",
  1298. "Which model to bind for source type PetriNets",
  1299. set(['"p1" --> 1',
  1300. '"p2" --> 2',
  1301. '"p3" --> 3',
  1302. ]),
  1303. "Ready for command...",
  1304. # transformation_execute (pn_design_to_runtime)
  1305. "Which transformation do you want to execute?",
  1306. "Which model to bind for source type PetriNets",
  1307. "Which model to create for target type PetriNets_Runtime",
  1308. "Ready for command...",
  1309. # transformation_execute (pn_step)
  1310. "Which transformation do you want to execute?",
  1311. "Which model to bind for source type PetriNets_Runtime",
  1312. "Which model to create for target type PetriNets_Runtime",
  1313. "Ready for command...",
  1314. # transformation_execute (pn_runtime_to_design)
  1315. "Which transformation do you want to execute?",
  1316. "Which model to bind for source type PetriNets_Runtime",
  1317. "Which model to create for target type PetriNets",
  1318. "Ready for command...",
  1319. # transformation_execute (pn_print)
  1320. "Which transformation do you want to execute?",
  1321. "Which model to bind for source type PetriNets",
  1322. set(['"p1" --> 0',
  1323. '"p2" --> 1',
  1324. '"p3" --> 5',
  1325. ]),
  1326. "Ready for command...",
  1327. ]))
  1328. def test_transform_add_MANUAL_pn_simulate(self):
  1329. self.assertTrue(run_file(all_files,
  1330. [ "root", "root", "root",
  1331. "model_add",
  1332. "SimpleClassDiagrams",
  1333. "PetriNets",
  1334. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  1335. "model_add",
  1336. "SimpleClassDiagrams",
  1337. "PetriNets_Runtime",
  1338. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  1339. "model_add",
  1340. "PetriNets",
  1341. "my_pn",
  1342. ] + get_model_constructor(open("integration/code/pn_design_model.mvc", "r").read()) + [
  1343. "model_list",
  1344. "transformation_add_MT_language",
  1345. "PetriNets_Runtime",
  1346. "PetriNets",
  1347. "",
  1348. "PetriNets_RAM",
  1349. "model_list",
  1350. "model_modify",
  1351. "__merged_PetriNets_RAM",
  1352. "instantiate",
  1353. "Association",
  1354. "D2R_PlaceLink",
  1355. "PetriNets/Place",
  1356. "PetriNets_Runtime/Place",
  1357. "instantiate",
  1358. "Association",
  1359. "D2R_TransitionLink",
  1360. "PetriNets/Transition",
  1361. "PetriNets_Runtime/Transition",
  1362. "instantiate",
  1363. "Association",
  1364. "R2D_PlaceLink",
  1365. "PetriNets_Runtime/Place",
  1366. "PetriNets/Place",
  1367. "instantiate",
  1368. "Association",
  1369. "R2D_TransitionLink",
  1370. "PetriNets_Runtime/Transition",
  1371. "PetriNets/Transition",
  1372. "exit",
  1373. "transformation_RAMify",
  1374. "__merged_PetriNets_RAM",
  1375. "PetriNets_RAM",
  1376. "transformation_add_MANUAL",
  1377. "PetriNets",
  1378. "",
  1379. "PetriNets_Runtime",
  1380. "",
  1381. "pn_design_to_runtime",
  1382. "transformation_add_MT",
  1383. "PetriNets_RAM",
  1384. "PetriNets_Runtime",
  1385. "",
  1386. "PetriNets",
  1387. "",
  1388. "pn_runtime_to_design",
  1389. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  1390. "transformation_add_MT",
  1391. "PetriNets_RAM",
  1392. "PetriNets_Runtime",
  1393. "",
  1394. "PetriNets_Runtime",
  1395. "",
  1396. "pn_step",
  1397. ] + get_model_constructor(open("integration/code/pn_simulate.mvc", "r").read()) + [
  1398. "transformation_add_MT",
  1399. "PetriNets_RAM",
  1400. "PetriNets",
  1401. "",
  1402. "",
  1403. "pn_print",
  1404. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  1405. "model_list",
  1406. "transformation_list",
  1407. "transformation_execute",
  1408. "pn_print",
  1409. "my_pn",
  1410. "transformation_execute",
  1411. "pn_design_to_runtime",
  1412. "my_pn",
  1413. "my_pn_runtime",
  1414. "instantiate", "PetriNets_Runtime/Place", "p1",
  1415. "attr_add", "p1", "tokens", 1,
  1416. "attr_add", "p1", "name", "p1",
  1417. "instantiate", "PetriNets_Runtime/Place", "p2",
  1418. "attr_add", "p2", "tokens", 2,
  1419. "attr_add", "p2", "name", "p2",
  1420. "instantiate", "PetriNets_Runtime/Place", "p3",
  1421. "attr_add", "p3", "tokens", 3,
  1422. "attr_add", "p3", "name", "p3",
  1423. "instantiate", "PetriNets_Runtime/Transition", "t1",
  1424. "attr_add", "t1", "name", "t1",
  1425. "instantiate", "PetriNets_Runtime/P2T", "p2t1", "p1", "t1",
  1426. "attr_add", "p2t1", "weight", 1,
  1427. "instantiate", "PetriNets_Runtime/P2T", "p2t2", "p2", "t1",
  1428. "attr_add", "p2t2", "weight", 1,
  1429. "instantiate", "PetriNets_Runtime/T2P", "t2p", "t1", "p3",
  1430. "attr_add", "t2p", "weight", 2,
  1431. "exit",
  1432. "transformation_execute",
  1433. "pn_step",
  1434. "my_pn_runtime",
  1435. "my_pn_runtime",
  1436. "transformation_execute",
  1437. "pn_runtime_to_design",
  1438. "my_pn_runtime",
  1439. "my_pn",
  1440. "transformation_execute",
  1441. "pn_print",
  1442. "my_pn",
  1443. ],
  1444. [ # bootup phase
  1445. "Desired username for admin user?",
  1446. "Desired password for admin user?",
  1447. "Please repeat the password",
  1448. "Passwords match!",
  1449. "Welcome to the Model Management Interface v2.0!",
  1450. "Use the 'help' command for a list of possible commands",
  1451. "Ready for command...",
  1452. # model_add
  1453. "Creating new model!",
  1454. "Model type?",
  1455. "Model name?",
  1456. "Waiting for model constructors...",
  1457. "Model upload success!",
  1458. "Ready for command...",
  1459. # model_add
  1460. "Creating new model!",
  1461. "Model type?",
  1462. "Model name?",
  1463. "Waiting for model constructors...",
  1464. "Model upload success!",
  1465. "Ready for command...",
  1466. # model_add
  1467. "Creating new model!",
  1468. "Model type?",
  1469. "Model name?",
  1470. "Waiting for model constructors...",
  1471. "Model upload success!",
  1472. "Ready for command...",
  1473. # model_list
  1474. set(model_list) |
  1475. set([
  1476. " PetriNets : SimpleClassDiagrams",
  1477. " my_pn : PetriNets",
  1478. " PetriNets_Runtime : SimpleClassDiagrams",]),
  1479. "Ready for command...",
  1480. # transformation_add_MT_language
  1481. "Formalisms to include (terminate with empty string)?",
  1482. "Name of the RAMified transformation metamodel?",
  1483. "Ready for command...",
  1484. # model_list
  1485. set(model_list) |
  1486. set([
  1487. " PetriNets_Runtime : SimpleClassDiagrams",
  1488. " PetriNets : SimpleClassDiagrams",
  1489. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1490. " PetriNets_RAM : SimpleClassDiagrams",
  1491. " my_pn : PetriNets",]),
  1492. "Ready for command...",
  1493. # model_modify
  1494. "Which model do you want to modify?",
  1495. "Model loaded, ready for commands!",
  1496. "Use 'help' command for a list of possible commands",
  1497. "Please give your command.",
  1498. # instantiate 1
  1499. "Type to instantiate?",
  1500. "Name of new element?",
  1501. "Source name?",
  1502. "Destination name?",
  1503. "Instantiation successful!",
  1504. "Please give your command.",
  1505. # instantiate 2
  1506. "Type to instantiate?",
  1507. "Name of new element?",
  1508. "Source name?",
  1509. "Destination name?",
  1510. "Instantiation successful!",
  1511. "Please give your command.",
  1512. # instantiate 3
  1513. "Type to instantiate?",
  1514. "Name of new element?",
  1515. "Source name?",
  1516. "Destination name?",
  1517. "Instantiation successful!",
  1518. "Please give your command.",
  1519. # instantiate 4
  1520. "Type to instantiate?",
  1521. "Name of new element?",
  1522. "Source name?",
  1523. "Destination name?",
  1524. "Instantiation successful!",
  1525. "Please give your command.",
  1526. "Ready for command...",
  1527. # transformation_RAMify
  1528. "Which metamodel do you want to RAMify?",
  1529. "Where do you want to store the RAMified metamodel?",
  1530. "Ready for command...",
  1531. # transformation_add_MANUAL
  1532. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1533. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1534. "Name of operation model?",
  1535. "Ready for command...",
  1536. # transformation_add_MT
  1537. "RAMified metamodel to use?",
  1538. "Supported metamodels:",
  1539. set([" PetriNets",
  1540. " PetriNets_Runtime",
  1541. ]),
  1542. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1543. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1544. "Name of new operation?",
  1545. "Waiting for model constructors...",
  1546. "Ready for command...",
  1547. # transformation_add_MT
  1548. "RAMified metamodel to use?",
  1549. "Supported metamodels:",
  1550. set([" PetriNets",
  1551. " PetriNets_Runtime",
  1552. ]),
  1553. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1554. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1555. "Name of new operation?",
  1556. "Waiting for model constructors...",
  1557. "Ready for command...",
  1558. # transformation_add_MT
  1559. "RAMified metamodel to use?",
  1560. "Supported metamodels:",
  1561. set([" PetriNets",
  1562. " PetriNets_Runtime",
  1563. ]),
  1564. "Which metamodels do you want to use as source for the operation (empty string to finish)?",
  1565. "Which metamodels do you want to use as target for the operation (empty string to finish)?",
  1566. "Name of new operation?",
  1567. "Waiting for model constructors...",
  1568. "Ready for command...",
  1569. # model_list
  1570. set(model_list) |
  1571. set([
  1572. " PetriNets_Runtime : SimpleClassDiagrams",
  1573. " PetriNets : SimpleClassDiagrams",
  1574. " pn_print : PetriNets_RAM",
  1575. " pn_design_to_runtime : ManualOperation",
  1576. " pn_runtime_to_design : PetriNets_RAM",
  1577. " pn_step : PetriNets_RAM",
  1578. " __merged_pn_design_to_runtime : SimpleClassDiagrams",
  1579. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  1580. " PetriNets_RAM : SimpleClassDiagrams",
  1581. " my_pn : PetriNets",]),
  1582. "Ready for command...",
  1583. # transformation_list
  1584. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  1585. "[ManualOperation] pn_design_to_runtime : ManualOperation",
  1586. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  1587. "[ModelTransformation] pn_step : PetriNets_RAM"]),
  1588. "Ready for command...",
  1589. # transformation_execute (pn_print)
  1590. "Which transformation do you want to execute?",
  1591. "Which model to bind for source type PetriNets",
  1592. set(['"p1" --> 1',
  1593. '"p2" --> 2',
  1594. '"p3" --> 3',
  1595. ]),
  1596. "Ready for command...",
  1597. # transformation_execute (pn_design_to_runtime)
  1598. "Which transformation do you want to execute?",
  1599. "Which model to bind for source type PetriNets",
  1600. "Which model to create for target type PetriNets_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. ]))