test_powerwindow.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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 TestPowerWindow(unittest.TestCase):
  33. def test_process_powerwindow(self):
  34. self.assertTrue(run_file(all_files,
  35. [ "root", "root", "root",
  36. "model_add",
  37. "SimpleClassDiagrams",
  38. "ReachabilityGraph",
  39. ] + get_model_constructor(open("integration/code/reachability_graph.mvc", "r").read()) + [
  40. "model_add",
  41. "SimpleClassDiagrams",
  42. "PetriNet",
  43. ] + get_model_constructor(open("integration/code/pn_design.mvc", "r").read()) + [
  44. "model_add",
  45. "SimpleClassDiagrams",
  46. "Encapsulated_PetriNet",
  47. ] + get_model_constructor(open("models/petrinet_ports.mvc", "r").read()) + [
  48. "model_add",
  49. "SimpleClassDiagrams",
  50. "PW_Plant",
  51. ] + get_model_constructor(open("models/plant_PW.mvc", "r").read()) + [
  52. "model_add",
  53. "SimpleClassDiagrams",
  54. "PW_Environment",
  55. ] + get_model_constructor(open("models/environment_PW.mvc", "r").read()) + [
  56. "model_add",
  57. "SimpleClassDiagrams",
  58. "PW_Control",
  59. ] + get_model_constructor(open("models/control_PW.mvc", "r").read()) + [
  60. "model_add",
  61. "SimpleClassDiagrams",
  62. "Requirements",
  63. ] + get_model_constructor(open("models/requirements.mvc", "r").read()) + [
  64. "model_add",
  65. "SimpleClassDiagrams",
  66. "Query",
  67. ] + get_model_constructor(open("models/query.mvc", "r").read()) + [
  68. "model_add",
  69. "SimpleClassDiagrams",
  70. "Network",
  71. ] + get_model_constructor(open("models/network.mvc", "r").read()) + [
  72. "model_add",
  73. "ProcessModel",
  74. "pm_powerwindow",
  75. ] + get_model_constructor(open("models/pm_req_analyse.mvc", "r").read()) + [
  76. "model_list",
  77. "transformation_add_MT_language",
  78. "PetriNet",
  79. "Encapsulated_PetriNet",
  80. "PW_Plant",
  81. "PW_Control",
  82. "PW_Environment",
  83. "Requirements",
  84. "ReachabilityGraph",
  85. "Network",
  86. "Query",
  87. "",
  88. "All_RAM",
  89. "transformation_add_MANUAL",
  90. "PW_Plant",
  91. "",
  92. "PW_Plant",
  93. "",
  94. "refine_Plant",
  95. "transformation_add_MT",
  96. "All_RAM",
  97. "",
  98. "PW_Plant",
  99. "PW_Environment",
  100. "PW_Control",
  101. "Network",
  102. "Query",
  103. "",
  104. "make_initial_models",
  105. ] + get_model_constructor(open("models/initialize.mvc", "r").read()) + [
  106. "transformation_add_MT",
  107. "All_RAM",
  108. "PW_Plant",
  109. "",
  110. "Encapsulated_PetriNet",
  111. "",
  112. "Plant2EPN",
  113. ] + get_model_constructor(open("models/plant_to_EPN.mvc", "r").read()) + [
  114. "transformation_add_AL",
  115. "PetriNet",
  116. "",
  117. "ReachabilityGraph",
  118. "",
  119. "reachability_analyse",
  120. ] + get_constructor(open("integration/code/reachability.alc", "r").read()) + [
  121. "transformation_add_AL",
  122. "PW_Environment",
  123. "",
  124. "Encapsulated_PetriNet",
  125. "",
  126. "environment_to_EPN",
  127. ] + get_constructor(open("models/environment_to_EPN.alc", "r").read()) + [
  128. "model_list",
  129. ],
  130. [ # bootup phase
  131. "Desired username for admin user?",
  132. "Desired password for admin user?",
  133. "Please repeat the password",
  134. "Passwords match!",
  135. "Welcome to the Model Management Interface v2.0!",
  136. "Use the 'help' command for a list of possible commands",
  137. "Ready for command...",
  138. # model_add * 10
  139. ] + [ "Creating new model!",
  140. "Model type?",
  141. "Model name?",
  142. "Waiting for model constructors...",
  143. "Model upload success!",
  144. "Ready for command...", ] * 10 + [
  145. # model_list
  146. model_list |
  147. set([
  148. " ReachabilityGraph : SimpleClassDiagrams",
  149. " PetriNet : SimpleClassDiagrams",
  150. " Encapsulated_PetriNet : SimpleClassDiagrams",
  151. " PW_Plant : SimpleClassDiagrams",
  152. " PW_Environment : SimpleClassDiagrams",
  153. " PW_Control : SimpleClassDiagrams",
  154. " Requirements : SimpleClassDiagrams",
  155. " Query : SimpleClassDiagrams",
  156. " Network : SimpleClassDiagrams",
  157. " pm_powerwindow : ProcessModel",
  158. ]),
  159. "Ready for command...",
  160. # transformation_add_MT_language
  161. "Formalisms to include (terminate with empty string)?",
  162. "Name of the RAMified transformation metamodel?",
  163. "Ready for command...",
  164. # transformation_add_MANUAL
  165. "Which metamodels do you want to use as source for the manual operation (empty string to finish)?",
  166. "Model added as source",
  167. "Which metamodels do you want to use as target for the manual operation (empty string to finish)?",
  168. "Model added as target",
  169. "Name of Manual operation model?",
  170. "Ready for command...",
  171. # transformation_add_MT
  172. "RAMified metamodel to use?",
  173. "Supported metamodels:",
  174. set([" PetriNet",
  175. " Encapsulated_PetriNet",
  176. " PW_Plant",
  177. " Network",
  178. " Query",
  179. " PW_Environment",
  180. " Requirements",
  181. " PW_Control",
  182. " ReachabilityGraph",
  183. ]),
  184. "",
  185. "Which ones do you want to use as source (empty string to finish)?",
  186. "Which ones do you want to use as target (empty string to finish)?",
  187. "Model added as target",
  188. "Model added as target",
  189. "Model added as target",
  190. "Model added as target",
  191. "Model added as target",
  192. "Name of new transformation?",
  193. "Waiting for model constructors...",
  194. "Ready for command...",
  195. # transformation_add_MT
  196. "RAMified metamodel to use?",
  197. "Supported metamodels:",
  198. set([" PetriNet",
  199. " Encapsulated_PetriNet",
  200. " Network",
  201. " Query",
  202. " PW_Plant",
  203. " PW_Environment",
  204. " Requirements",
  205. " PW_Control",
  206. " ReachabilityGraph",
  207. ]),
  208. "",
  209. "Which ones do you want to use as source (empty string to finish)?",
  210. "Model added as source",
  211. "Which ones do you want to use as target (empty string to finish)?",
  212. "Model added as target",
  213. "Name of new transformation?",
  214. "Waiting for model constructors...",
  215. "Ready for command...",
  216. # transformation_add_AL
  217. "Which metamodels do you want to use as source for the action code (empty string to finish)?",
  218. "Model added as source",
  219. "Which metamodels do you want to use as target for the action code (empty string to finish)?",
  220. "Model added as target",
  221. "Name of Action Language model?",
  222. "Waiting for model constructors...",
  223. "Ready for command...",
  224. # transformation_add_AL
  225. "Which metamodels do you want to use as source for the action code (empty string to finish)?",
  226. "Model added as source",
  227. "Which metamodels do you want to use as target for the action code (empty string to finish)?",
  228. "Model added as target",
  229. "Name of Action Language model?",
  230. "Waiting for model constructors...",
  231. "Ready for command...",
  232. # model_list
  233. model_list |
  234. set([
  235. " PetriNet : SimpleClassDiagrams",
  236. " Encapsulated_PetriNet : SimpleClassDiagrams",
  237. " PW_Plant : SimpleClassDiagrams",
  238. " PW_Environment : SimpleClassDiagrams",
  239. " PW_Control : SimpleClassDiagrams",
  240. " Requirements : SimpleClassDiagrams",
  241. " Network : SimpleClassDiagrams",
  242. " Query : SimpleClassDiagrams",
  243. " reachability_analyse : ActionLanguage",
  244. " Plant2EPN : All_RAM",
  245. " refine_Plant : ManualOperation",
  246. " __merged_All_RAM : SimpleClassDiagrams",
  247. " __merged_refine_Plant : SimpleClassDiagrams",
  248. " All_RAM : SimpleClassDiagrams",
  249. " make_initial_models : All_RAM",
  250. " pm_powerwindow : ProcessModel",
  251. " environment_to_EPN : ActionLanguage",
  252. " ReachabilityGraph : SimpleClassDiagrams",
  253. ]),
  254. "Ready for command...",
  255. ]))