test_SCCD.py 786 B

12345678910111213141516171819202122232425262728
  1. import sys
  2. sys.path.append("wrappers")
  3. from modelverse import *
  4. init()
  5. login("admin", "admin")
  6. # Assume that we don't change the SCCD MM
  7. try:
  8. model_add("SCCD", "SimpleClassDiagrams", open("models/SCCD.mvc", 'r').read())
  9. except ModelExists:
  10. pass
  11. # Update the model of the traffic light
  12. if "my_SCCD" in [i[0] for i in model_list()]:
  13. model_delete("my_SCCD")
  14. model_add("my_SCCD", "SCCD", open("models/dynamic_trafficlight.mvc", 'r').read())
  15. # Add SCCD execution semantics
  16. transformation_add_AL({"SCCD": "SCCD"}, {}, "SCCD_execute", open("models/SCCD_execute.alc", 'r').read())
  17. # Execute it, while interacting through the console
  18. def callback(inp):
  19. print(inp)
  20. return raw_input()
  21. transformation_execute_AL("SCCD_execute", {"SCCD": "my_SCCD"}, {}, callback=callback)