test_mvc.py 93 KB

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