test_mvc.py 67 KB

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