test_mvc.py 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. import unittest
  2. from utils import run_file, get_constructor, get_model_constructor
  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. "ftg.alc",
  11. "transform.alc",
  12. "model_management.alc",
  13. "ramify.alc",
  14. "metamodels.alc",
  15. "random.alc",
  16. "constructors.alc",
  17. "modelling.alc",
  18. "compilation_manager.alc",
  19. ]
  20. class TestModelverseCore(unittest.TestCase):
  21. def test_po_list(self):
  22. self.list("PO")
  23. def list(self, mode):
  24. self.assertTrue(run_file(all_files,
  25. [ "root", "root", "root",
  26. "model_list",
  27. ],
  28. [ "Desired username for admin user?",
  29. "Desired password for admin user?",
  30. "Please repeat the password",
  31. "Passwords match!",
  32. "Welcome to the Model Management Interface v2.0!",
  33. "Use the 'help' command for a list of possible commands",
  34. "Ready for command...",
  35. set([" SimpleClassDiagrams : SimpleClassDiagrams",
  36. " CoreFormalism : SimpleClassDiagrams",
  37. " core : CoreFormalism"]),
  38. ],
  39. mode))
  40. def test_po_list_full(self):
  41. self.list_full("PO")
  42. def list_full(self, mode):
  43. self.assertTrue(run_file(all_files,
  44. [ "root", "root", "root",
  45. "model_list_full",
  46. ],
  47. [ "Desired username for admin user?",
  48. "Desired password for admin user?",
  49. "Please repeat the password",
  50. "Passwords match!",
  51. "Welcome to the Model Management Interface v2.0!",
  52. "Use the 'help' command for a list of possible commands",
  53. "Ready for command...",
  54. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  55. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  56. " 200 root admin 45 core : CoreFormalism"]),
  57. ],
  58. mode))
  59. def test_po_model_add_empty(self):
  60. self.model_add_empty("PO")
  61. def model_add_empty(self, mode):
  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. set([" SimpleClassDiagrams : SimpleClassDiagrams",
  85. " CoreFormalism : SimpleClassDiagrams",
  86. " Empty : SimpleClassDiagrams",
  87. " core : CoreFormalism"]),
  88. "Ready for command...",
  89. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  90. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  91. " 200 root nobody 0 Empty : SimpleClassDiagrams",
  92. " 200 root admin 55 core : CoreFormalism"]),
  93. ],
  94. mode))
  95. def test_po_model_empty_modify(self):
  96. self.model_empty_modify("PO")
  97. def model_empty_modify(self, mode):
  98. self.assertTrue(run_file(all_files,
  99. [ "root", "root", "root",
  100. "model_add",
  101. "SimpleClassDiagrams",
  102. "Empty",
  103. "exit",
  104. "model_list",
  105. "model_list_full",
  106. "model_modify",
  107. "Empty",
  108. "instantiate",
  109. "Class",
  110. "A",
  111. "exit",
  112. "model_list_full",
  113. ],
  114. [ "Desired username for admin user?",
  115. "Desired password for admin user?",
  116. "Please repeat the password",
  117. "Passwords match!",
  118. "Welcome to the Model Management Interface v2.0!",
  119. "Use the 'help' command for a list of possible commands",
  120. "Ready for command...",
  121. "Creating new model!",
  122. "Model type?",
  123. "Model name?",
  124. "Waiting for model constructors...",
  125. "Model upload success!",
  126. "Ready for command...",
  127. set([" SimpleClassDiagrams : SimpleClassDiagrams",
  128. " CoreFormalism : SimpleClassDiagrams",
  129. " Empty : SimpleClassDiagrams",
  130. " core : CoreFormalism"]),
  131. "Ready for command...",
  132. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  133. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  134. " 200 root nobody 0 Empty : SimpleClassDiagrams",
  135. " 200 root admin 55 core : CoreFormalism"]),
  136. "Ready for command...",
  137. "Which model do you want to modify?",
  138. "Model loaded, ready for commands!",
  139. "Use 'help' command for a list of possible commands",
  140. "Please give your command.",
  141. "Type to instantiate?",
  142. "Name of new element?",
  143. "Instantiation successful!",
  144. "Please give your command.",
  145. "Ready for command...",
  146. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  147. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  148. " 200 root nobody 1 Empty : SimpleClassDiagrams",
  149. " 200 root admin 55 core : CoreFormalism"]),
  150. "Ready for command...",
  151. ],
  152. mode))
  153. def test_po_model_overwrite(self):
  154. self.model_overwrite("PO")
  155. def model_overwrite(self, mode):
  156. self.assertTrue(run_file(all_files,
  157. [ "root", "root", "root",
  158. "model_add",
  159. "SimpleClassDiagrams",
  160. "Empty",
  161. "exit",
  162. "model_list_full",
  163. "model_modify",
  164. "Empty",
  165. "instantiate",
  166. "Class",
  167. "A",
  168. "exit",
  169. "model_list_full",
  170. "model_overwrite",
  171. "Empty",
  172. "instantiate_node",
  173. "",
  174. "Class",
  175. "B",
  176. "instantiate_node",
  177. "",
  178. "Class",
  179. "C",
  180. "exit",
  181. "model_list_full",
  182. "model_modify",
  183. "Empty",
  184. "list",
  185. "exit",
  186. ],
  187. [ "Desired username for admin user?",
  188. "Desired password for admin user?",
  189. "Please repeat the password",
  190. "Passwords match!",
  191. "Welcome to the Model Management Interface v2.0!",
  192. "Use the 'help' command for a list of possible commands",
  193. "Ready for command...",
  194. "Creating new model!",
  195. "Model type?",
  196. "Model name?",
  197. "Waiting for model constructors...",
  198. "Model upload success!",
  199. "Ready for command...",
  200. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  201. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  202. " 200 root nobody 0 Empty : SimpleClassDiagrams",
  203. " 200 root admin 55 core : CoreFormalism"]),
  204. "Ready for command...",
  205. "Which model do you want to modify?",
  206. "Model loaded, ready for commands!",
  207. "Use 'help' command for a list of possible commands",
  208. "Please give your command.",
  209. "Type to instantiate?",
  210. "Name of new element?",
  211. "Instantiation successful!",
  212. "Please give your command.",
  213. "Ready for command...",
  214. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  215. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  216. " 200 root nobody 1 Empty : SimpleClassDiagrams",
  217. " 200 root admin 55 core : CoreFormalism"]),
  218. "Ready for command...",
  219. "Which model to overwrite?",
  220. "Waiting for model constructors...",
  221. "Model overwrite success!",
  222. "Ready for command...",
  223. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  224. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  225. " 200 root nobody 2 Empty : SimpleClassDiagrams",
  226. " 200 root admin 55 core : CoreFormalism"]),
  227. "Ready for command...",
  228. "Which model do you want to modify?",
  229. "Model loaded, ready for commands!",
  230. "Use 'help' command for a list of possible commands",
  231. "Please give your command.",
  232. "List of all elements:",
  233. set([" B : Class",
  234. " C : Class"]),
  235. "Please give your command.",
  236. "Ready for command...",
  237. ],
  238. mode))
  239. def test_po_transform_add_MT_language(self):
  240. self.transform_add_MT_language("PO")
  241. def transform_add_MT_language(self, mode):
  242. self.assertTrue(run_file(all_files,
  243. [ "root", "root", "root",
  244. "model_add",
  245. "SimpleClassDiagrams",
  246. "PetriNets",
  247. ] + get_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
  248. "model_list_full",
  249. "transformation_add_MT_language",
  250. "PetriNets",
  251. "",
  252. "PetriNets_RAM",
  253. "model_list_full",
  254. ],
  255. [ "Desired username for admin user?",
  256. "Desired password for admin user?",
  257. "Please repeat the password",
  258. "Passwords match!",
  259. "Welcome to the Model Management Interface v2.0!",
  260. "Use the 'help' command for a list of possible commands",
  261. "Ready for command...",
  262. "Creating new model!",
  263. "Model type?",
  264. "Model name?",
  265. "Waiting for model constructors...",
  266. "Model upload success!",
  267. "Ready for command...",
  268. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  269. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  270. " 200 root nobody 14 PetriNets : SimpleClassDiagrams",
  271. " 200 root admin 55 core : CoreFormalism"]),
  272. "Ready for command...",
  273. "Formalisms to include (terminate with empty string)?",
  274. "Name of the RAMified transformation metamodel?",
  275. "Ready for command...",
  276. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  277. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  278. " 200 root nobody 14 PetriNets : SimpleClassDiagrams",
  279. " 200 root nobody 14 __merged_PetriNets_RAM : SimpleClassDiagrams",
  280. " 200 root nobody 328 PetriNets_RAM : SimpleClassDiagrams",
  281. " 200 root admin 81 core : CoreFormalism"]),
  282. "Ready for command...",
  283. ],
  284. mode))
  285. def test_po_transform_add_MT_instance(self):
  286. self.transform_add_MT_instance("PO")
  287. def transform_add_MT_instance(self, mode):
  288. self.assertTrue(run_file(all_files,
  289. [ "root", "root", "root",
  290. "model_add",
  291. "SimpleClassDiagrams",
  292. "PetriNets",
  293. ] + get_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
  294. "model_list_full",
  295. "transformation_add_MT_language",
  296. "PetriNets",
  297. "",
  298. "PetriNets_RAM",
  299. "model_list_full",
  300. "transformation_add_MT",
  301. "PetriNets_RAM",
  302. "PetriNets",
  303. "",
  304. "",
  305. "PetriNets_Print",
  306. "exit",
  307. "model_list_full",
  308. "transformation_list",
  309. "transformation_list_full",
  310. ],
  311. [ "Desired username for admin user?",
  312. "Desired password for admin user?",
  313. "Please repeat the password",
  314. "Passwords match!",
  315. "Welcome to the Model Management Interface v2.0!",
  316. "Use the 'help' command for a list of possible commands",
  317. "Ready for command...",
  318. "Creating new model!",
  319. "Model type?",
  320. "Model name?",
  321. "Waiting for model constructors...",
  322. "Model upload success!",
  323. "Ready for command...",
  324. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  325. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  326. " 200 root nobody 14 PetriNets : SimpleClassDiagrams",
  327. " 200 root admin 55 core : CoreFormalism"]),
  328. "Ready for command...",
  329. "Formalisms to include (terminate with empty string)?",
  330. "Name of the RAMified transformation metamodel?",
  331. "Ready for command...",
  332. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  333. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  334. " 200 root nobody 14 PetriNets : SimpleClassDiagrams",
  335. " 200 root nobody 14 __merged_PetriNets_RAM : SimpleClassDiagrams",
  336. " 200 root nobody 328 PetriNets_RAM : SimpleClassDiagrams",
  337. " 200 root admin 81 core : CoreFormalism"]),
  338. "Ready for command...",
  339. "RAMified metamodel to use?",
  340. "Supported metamodels:",
  341. set([" PetriNets",
  342. ]),
  343. "",
  344. "Which ones do you want to use as source (empty string to finish)?",
  345. "Model added as source",
  346. "Which ones do you want to use as target (empty string to finish)?",
  347. "Name of new transformation?",
  348. "Waiting for model constructors...",
  349. "Ready for command...",
  350. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  351. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  352. " 200 root nobody 14 PetriNets : SimpleClassDiagrams",
  353. " 200 root nobody 14 __merged_PetriNets_RAM : SimpleClassDiagrams",
  354. " 200 root nobody 328 PetriNets_RAM : SimpleClassDiagrams",
  355. " 200 root nobody 0 PetriNets_Print : PetriNets_RAM",
  356. " 200 root admin 94 core : CoreFormalism"]),
  357. "Ready for command...",
  358. set(["[ModelTransformation] PetriNets_Print : PetriNets_RAM",
  359. ]),
  360. "Ready for command...",
  361. set([" 200 root nobody 0 [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  362. ]),
  363. "Ready for command...",
  364. ],
  365. mode))
  366. def test_po_transform_add_MT_pn_print_upload(self):
  367. self.transform_add_MT_pn_print_upload("PO")
  368. def transform_add_MT_pn_print_upload(self, mode):
  369. self.assertTrue(run_file(all_files,
  370. [ "root", "root", "root",
  371. "model_add",
  372. "SimpleClassDiagrams",
  373. "PetriNets",
  374. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  375. "model_list_full",
  376. "transformation_add_MT_language",
  377. "PetriNets",
  378. "",
  379. "PetriNets_RAM",
  380. "model_list_full",
  381. "transformation_add_MT",
  382. "PetriNets_RAM",
  383. "PetriNets",
  384. "",
  385. "",
  386. "PetriNets_Print",
  387. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  388. "transformation_list_full",
  389. ],
  390. [ "Desired username for admin user?",
  391. "Desired password for admin user?",
  392. "Please repeat the password",
  393. "Passwords match!",
  394. "Welcome to the Model Management Interface v2.0!",
  395. "Use the 'help' command for a list of possible commands",
  396. "Ready for command...",
  397. "Creating new model!",
  398. "Model type?",
  399. "Model name?",
  400. "Waiting for model constructors...",
  401. "Model upload success!",
  402. "Ready for command...",
  403. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  404. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  405. " 200 root nobody 22 PetriNets : SimpleClassDiagrams",
  406. " 200 root admin 55 core : CoreFormalism"]),
  407. "Ready for command...",
  408. "Formalisms to include (terminate with empty string)?",
  409. "Name of the RAMified transformation metamodel?",
  410. "Ready for command...",
  411. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  412. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  413. " 200 root nobody 22 PetriNets : SimpleClassDiagrams",
  414. " 200 root nobody 22 __merged_PetriNets_RAM : SimpleClassDiagrams",
  415. " 200 root nobody 352 PetriNets_RAM : SimpleClassDiagrams",
  416. " 200 root admin 81 core : CoreFormalism"]),
  417. "Ready for command...",
  418. "RAMified metamodel to use?",
  419. "Supported metamodels:",
  420. set([" PetriNets",
  421. ]),
  422. "",
  423. "Which ones do you want to use as source (empty string to finish)?",
  424. "Model added as source",
  425. "Which ones do you want to use as target (empty string to finish)?",
  426. "Name of new transformation?",
  427. "Waiting for model constructors...",
  428. "Ready for command...",
  429. set([" 200 root nobody 26 [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  430. ]),
  431. "Ready for command...",
  432. ],
  433. mode))
  434. def test_po_transform_add_MT_pn_print_exec(self):
  435. self.transform_add_MT_pn_print_exec("PO")
  436. def transform_add_MT_pn_print_exec(self, mode):
  437. self.assertTrue(run_file(all_files,
  438. [ "root", "root", "root",
  439. "model_add",
  440. "SimpleClassDiagrams",
  441. "PetriNets",
  442. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  443. "model_add",
  444. "PetriNets",
  445. "my_pn",
  446. ] + get_model_constructor(open("integration/code/pn_runtime_model.mvc", "r").read()) + [
  447. "model_list_full",
  448. "transformation_add_MT_language",
  449. "PetriNets",
  450. "",
  451. "PetriNets_RAM",
  452. "model_list_full",
  453. "transformation_add_MT",
  454. "PetriNets_RAM",
  455. "PetriNets",
  456. "",
  457. "",
  458. "PetriNets_Print",
  459. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  460. "transformation_list_full",
  461. "transformation_execute",
  462. "PetriNets_Print",
  463. "my_pn",
  464. "transformation_list_full",
  465. ],
  466. [ "Desired username for admin user?",
  467. "Desired password for admin user?",
  468. "Please repeat the password",
  469. "Passwords match!",
  470. "Welcome to the Model Management Interface v2.0!",
  471. "Use the 'help' command for a list of possible commands",
  472. "Ready for command...",
  473. "Creating new model!",
  474. "Model type?",
  475. "Model name?",
  476. "Waiting for model constructors...",
  477. "Model upload success!",
  478. "Ready for command...",
  479. "Creating new model!",
  480. "Model type?",
  481. "Model name?",
  482. "Waiting for model constructors...",
  483. "Model upload success!",
  484. "Ready for command...",
  485. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  486. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  487. " 200 root nobody 22 PetriNets : SimpleClassDiagrams",
  488. " 200 root nobody 27 my_pn : PetriNets",
  489. " 200 root admin 65 core : CoreFormalism"]),
  490. "Ready for command...",
  491. "Formalisms to include (terminate with empty string)?",
  492. "Name of the RAMified transformation metamodel?",
  493. "Ready for command...",
  494. set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
  495. " 221 root admin 90 CoreFormalism : SimpleClassDiagrams",
  496. " 200 root nobody 22 PetriNets : SimpleClassDiagrams",
  497. " 200 root nobody 22 __merged_PetriNets_RAM : SimpleClassDiagrams",
  498. " 200 root nobody 352 PetriNets_RAM : SimpleClassDiagrams",
  499. " 200 root nobody 27 my_pn : PetriNets",
  500. " 200 root admin 91 core : CoreFormalism"]),
  501. "Ready for command...",
  502. "RAMified metamodel to use?",
  503. "Supported metamodels:",
  504. set([" PetriNets",
  505. ]),
  506. "",
  507. "Which ones do you want to use as source (empty string to finish)?",
  508. "Model added as source",
  509. "Which ones do you want to use as target (empty string to finish)?",
  510. "Name of new transformation?",
  511. "Waiting for model constructors...",
  512. "Ready for command...",
  513. set([" 200 root nobody 26 [ModelTransformation] PetriNets_Print : PetriNets_RAM"
  514. ]),
  515. "Ready for command...",
  516. "Which transformation do you want to execute?",
  517. "Which model to bind for source element PetriNets",
  518. set(['"p1" --> 1',
  519. '"p2" --> 2',
  520. '"p3" --> 3',
  521. ]),
  522. "Transformation executed with result: True",
  523. "Ready for command...",
  524. ],
  525. mode))
  526. def test_po_transform_add_MT_pn_simulate(self):
  527. self.transform_add_MT_pn_simulate("PO")
  528. def transform_add_MT_pn_simulate(self, mode):
  529. self.assertTrue(run_file(all_files,
  530. [ "root", "root", "root",
  531. "model_add",
  532. "SimpleClassDiagrams",
  533. "PetriNets",
  534. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  535. "model_add",
  536. "SimpleClassDiagrams",
  537. "PetriNets_Runtime",
  538. ] + get_model_constructor(open("integration/code/pn_runtime.mvc", "r").read()) + [
  539. "model_add",
  540. "PetriNets",
  541. "my_pn",
  542. ] + get_model_constructor(open("integration/code/pn_design_model.mvc", "r").read()) + [
  543. "model_list",
  544. "transformation_add_MT_language",
  545. "PetriNets_Runtime",
  546. "PetriNets",
  547. "",
  548. "PetriNets_RAM",
  549. "model_list",
  550. "model_modify",
  551. "__merged_PetriNets_RAM",
  552. "instantiate",
  553. "Association",
  554. "D2R_PlaceLink",
  555. "PetriNets/Place",
  556. "PetriNets_Runtime/Place",
  557. "instantiate",
  558. "Association",
  559. "D2R_TransitionLink",
  560. "PetriNets/Transition",
  561. "PetriNets_Runtime/Transition",
  562. "instantiate",
  563. "Association",
  564. "R2D_PlaceLink",
  565. "PetriNets_Runtime/Place",
  566. "PetriNets/Place",
  567. "instantiate",
  568. "Association",
  569. "R2D_TransitionLink",
  570. "PetriNets_Runtime/Transition",
  571. "PetriNets/Transition",
  572. "exit",
  573. "transformation_RAMify",
  574. "__merged_PetriNets_RAM",
  575. "PetriNets_RAM",
  576. "transformation_add_MT",
  577. "PetriNets_RAM",
  578. "PetriNets",
  579. "",
  580. "PetriNets_Runtime",
  581. "",
  582. "pn_design_to_runtime",
  583. ] + get_model_constructor(open("integration/code/pn_design_to_runtime.mvc", "r").read()) + [
  584. "transformation_add_MT",
  585. "PetriNets_RAM",
  586. "PetriNets_Runtime",
  587. "",
  588. "PetriNets",
  589. "",
  590. "pn_runtime_to_design",
  591. ] + get_model_constructor(open("integration/code/pn_runtime_to_design.mvc", "r").read()) + [
  592. "transformation_add_MT",
  593. "PetriNets_RAM",
  594. "PetriNets_Runtime",
  595. "",
  596. "PetriNets_Runtime",
  597. "",
  598. "pn_step",
  599. ] + get_model_constructor(open("integration/code/pn_simulate.mvc", "r").read()) + [
  600. "transformation_add_MT",
  601. "PetriNets_RAM",
  602. "PetriNets",
  603. "",
  604. "",
  605. "pn_print",
  606. ] + get_model_constructor(open("integration/code/pn_print.mvc", "r").read()) + [
  607. "model_list",
  608. "transformation_list",
  609. "transformation_execute",
  610. "pn_print",
  611. "my_pn",
  612. "transformation_execute",
  613. "pn_design_to_runtime",
  614. "my_pn",
  615. "my_pn_runtime",
  616. "transformation_execute",
  617. "pn_step",
  618. "my_pn_runtime",
  619. "my_pn_runtime",
  620. "transformation_execute",
  621. "pn_runtime_to_design",
  622. "my_pn_runtime",
  623. "my_pn",
  624. "transformation_execute",
  625. "pn_print",
  626. "my_pn",
  627. ],
  628. [ # bootup phase
  629. "Desired username for admin user?",
  630. "Desired password for admin user?",
  631. "Please repeat the password",
  632. "Passwords match!",
  633. "Welcome to the Model Management Interface v2.0!",
  634. "Use the 'help' command for a list of possible commands",
  635. "Ready for command...",
  636. # model_add
  637. "Creating new model!",
  638. "Model type?",
  639. "Model name?",
  640. "Waiting for model constructors...",
  641. "Model upload success!",
  642. "Ready for command...",
  643. # model_add
  644. "Creating new model!",
  645. "Model type?",
  646. "Model name?",
  647. "Waiting for model constructors...",
  648. "Model upload success!",
  649. "Ready for command...",
  650. # model_add
  651. "Creating new model!",
  652. "Model type?",
  653. "Model name?",
  654. "Waiting for model constructors...",
  655. "Model upload success!",
  656. "Ready for command...",
  657. # model_list
  658. set([" SimpleClassDiagrams : SimpleClassDiagrams",
  659. " CoreFormalism : SimpleClassDiagrams",
  660. " PetriNets : SimpleClassDiagrams",
  661. " my_pn : PetriNets",
  662. " PetriNets_Runtime : SimpleClassDiagrams",
  663. " core : CoreFormalism"]),
  664. "Ready for command...",
  665. # transformation_add_MT_language
  666. "Formalisms to include (terminate with empty string)?",
  667. "Name of the RAMified transformation metamodel?",
  668. "Ready for command...",
  669. # model_list
  670. set([" SimpleClassDiagrams : SimpleClassDiagrams",
  671. " CoreFormalism : SimpleClassDiagrams",
  672. " PetriNets_Runtime : SimpleClassDiagrams",
  673. " PetriNets : SimpleClassDiagrams",
  674. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  675. " PetriNets_RAM : SimpleClassDiagrams",
  676. " my_pn : PetriNets",
  677. " core : CoreFormalism"]),
  678. "Ready for command...",
  679. # model_modify
  680. "Which model do you want to modify?",
  681. "Model loaded, ready for commands!",
  682. "Use 'help' command for a list of possible commands",
  683. "Please give your command.",
  684. # instantiate 1
  685. "Type to instantiate?",
  686. "Name of new element?",
  687. "Source name?",
  688. "Destination name?",
  689. "Instantiation successful!",
  690. "Please give your command.",
  691. # instantiate 2
  692. "Type to instantiate?",
  693. "Name of new element?",
  694. "Source name?",
  695. "Destination name?",
  696. "Instantiation successful!",
  697. "Please give your command.",
  698. # instantiate 3
  699. "Type to instantiate?",
  700. "Name of new element?",
  701. "Source name?",
  702. "Destination name?",
  703. "Instantiation successful!",
  704. "Please give your command.",
  705. # instantiate 4
  706. "Type to instantiate?",
  707. "Name of new element?",
  708. "Source name?",
  709. "Destination name?",
  710. "Instantiation successful!",
  711. "Please give your command.",
  712. "Ready for command...",
  713. # transformation_RAMify
  714. "Which metamodel do you want to RAMify?",
  715. "Where do you want to store the RAMified metamodel?",
  716. "Ready for command...",
  717. # transformation_add_MT
  718. "RAMified metamodel to use?",
  719. "Supported metamodels:",
  720. set([" PetriNets",
  721. " PetriNets_Runtime",
  722. ]),
  723. "",
  724. "Which ones do you want to use as source (empty string to finish)?",
  725. "Model added as source",
  726. "Which ones do you want to use as target (empty string to finish)?",
  727. "Model added as target",
  728. "Name of new transformation?",
  729. "Waiting for model constructors...",
  730. "Ready for command...",
  731. # transformation_add_MT
  732. "RAMified metamodel to use?",
  733. "Supported metamodels:",
  734. set([" PetriNets",
  735. " PetriNets_Runtime",
  736. ]),
  737. "",
  738. "Which ones do you want to use as source (empty string to finish)?",
  739. "Model added as source",
  740. "Which ones do you want to use as target (empty string to finish)?",
  741. "Model added as target",
  742. "Name of new transformation?",
  743. "Waiting for model constructors...",
  744. "Ready for command...",
  745. # transformation_add_MT
  746. "RAMified metamodel to use?",
  747. "Supported metamodels:",
  748. set([" PetriNets",
  749. " PetriNets_Runtime",
  750. ]),
  751. "",
  752. "Which ones do you want to use as source (empty string to finish)?",
  753. "Model added as source",
  754. "Which ones do you want to use as target (empty string to finish)?",
  755. "Model added as target",
  756. "Name of new transformation?",
  757. "Waiting for model constructors...",
  758. "Ready for command...",
  759. # transformation_add_MT
  760. "RAMified metamodel to use?",
  761. "Supported metamodels:",
  762. set([" PetriNets",
  763. " PetriNets_Runtime",
  764. ]),
  765. "",
  766. "Which ones do you want to use as source (empty string to finish)?",
  767. "Model added as source",
  768. "Which ones do you want to use as target (empty string to finish)?",
  769. "Name of new transformation?",
  770. "Waiting for model constructors...",
  771. "Ready for command...",
  772. # model_list
  773. set([" SimpleClassDiagrams : SimpleClassDiagrams",
  774. " CoreFormalism : SimpleClassDiagrams",
  775. " PetriNets_Runtime : SimpleClassDiagrams",
  776. " PetriNets : SimpleClassDiagrams",
  777. " pn_print : PetriNets_RAM",
  778. " pn_design_to_runtime : PetriNets_RAM",
  779. " pn_runtime_to_design : PetriNets_RAM",
  780. " pn_step : PetriNets_RAM",
  781. " __merged_PetriNets_RAM : SimpleClassDiagrams",
  782. " PetriNets_RAM : SimpleClassDiagrams",
  783. " my_pn : PetriNets",
  784. " core : CoreFormalism"]),
  785. "Ready for command...",
  786. # transformation_list
  787. set(["[ModelTransformation] pn_print : PetriNets_RAM",
  788. "[ModelTransformation] pn_design_to_runtime : PetriNets_RAM",
  789. "[ModelTransformation] pn_runtime_to_design : PetriNets_RAM",
  790. "[ModelTransformation] pn_step : PetriNets_RAM"]),
  791. "Ready for command...",
  792. # transformation_execute (pn_print)
  793. "Which transformation do you want to execute?",
  794. "Which model to bind for source element PetriNets",
  795. set(['"p1" --> 1',
  796. '"p2" --> 2',
  797. '"p3" --> 3',
  798. ]),
  799. "Transformation executed with result: True",
  800. "Ready for command...",
  801. # transformation_execute (pn_design_to_runtime)
  802. "Which transformation do you want to execute?",
  803. "Which model to bind for source element PetriNets",
  804. "Which model to create for target element PetriNets_Runtime",
  805. "Transformation executed with result: True",
  806. "Ready for command...",
  807. # transformation_execute (pn_step)
  808. "Which transformation do you want to execute?",
  809. "Which model to bind for source element PetriNets_Runtime",
  810. "Which model to create for target element PetriNets_Runtime",
  811. "Transformation executed with result: True",
  812. "Ready for command...",
  813. # transformation_execute (pn_runtime_to_design)
  814. "Which transformation do you want to execute?",
  815. "Which model to bind for source element PetriNets_Runtime",
  816. "Which model to create for target element PetriNets",
  817. "Transformation executed with result: True",
  818. "Ready for command...",
  819. # transformation_execute (pn_print)
  820. "Which transformation do you want to execute?",
  821. "Which model to bind for source element PetriNets",
  822. set(['"p1" --> 0',
  823. '"p2" --> 1',
  824. '"p3" --> 5',
  825. ]),
  826. "Transformation executed with result: True",
  827. "Ready for command...",
  828. ],
  829. mode))