Explorar el Código

Added debug test for the PM, which prints intermediate values

Yentl Van Tendeloo hace 8 años
padre
commit
fc9670e372
Se han modificado 2 ficheros con 424 adiciones y 35 borrados
  1. 420 0
      integration/test_powerwindow.py
  2. 4 35
      models/pm_req_analyse.mvc

+ 420 - 0
integration/test_powerwindow.py

@@ -454,3 +454,423 @@ class TestPowerWindow(unittest.TestCase):
                 # Finished, so we go back to the start
                 "Ready for command...",
             ]))
+
+    @slow
+    def test_process_powerwindow_debug(self):
+        self.assertTrue(run_file(all_files,
+            [ "root", "root", "root", 
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "ReachabilityGraph",
+                    ] + get_model_constructor_2("models/reachability_graph.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "PetriNet",
+                    ] + get_model_constructor_2("integration/code/pn_design.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "Encapsulated_PetriNet",
+                    ] + get_model_constructor_2("models/petrinet_ports.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "PW_Plant",
+                    ] + get_model_constructor_2("models/plant_PW.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "PW_Environment",
+                    ] + get_model_constructor_2("models/environment_PW.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "PW_Control",
+                    ] + get_model_constructor_2("models/control_PW.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "Requirements",
+                    ] + get_model_constructor_2("models/requirements.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "Query",
+                    ] + get_model_constructor_2("models/query.mvc") + [
+                "model_add",
+                    "ProcessModel",
+                    "pm_powerwindow",
+                    ] + get_model_constructor_2("models/pm_req_analyse_debug.mvc") + [
+                "model_add",
+                    "SimpleClassDiagrams",
+                    "Architecture",
+                    ] + get_model_constructor_2("models/architecture.mvc") + [
+                "model_list",
+                "transformation_add_MT_language",
+                "PetriNet",
+                "Encapsulated_PetriNet",
+                "PW_Plant",
+                "PW_Control",
+                "PW_Environment",
+                "Requirements",
+                "ReachabilityGraph",
+                "Query",
+                "Architecture",
+                "",
+                "All_RAM",
+                "model_modify",
+                    "__merged_All_RAM",
+                        "instantiate",
+                            "Association",
+                            "CTRL2EPN_link",
+                            "PW_Control/State",
+                            "Encapsulated_PetriNet/Place",
+                        "instantiate",
+                            "Association",
+                            "CTRL2EPN_tlink",
+                            "PW_Control/Transition",
+                            "Encapsulated_PetriNet/Transition",
+                        "instantiate",
+                            "Association",
+                            "PLANT2EPN_link",
+                            "PW_Plant/State",
+                            "Encapsulated_PetriNet/Place",
+                        "instantiate",
+                            "Association",
+                            "PLANT2EPN_tlink",
+                            "PW_Plant/Transition",
+                            "Encapsulated_PetriNet/Transition",
+                        "instantiate",
+                            "Association",
+                            "ENV2EPN_link",
+                            "PW_Environment/Event",
+                            "Encapsulated_PetriNet/Place",
+                        "instantiate",
+                            "Association",
+                            "EPN2PN_place_link",
+                            "Encapsulated_PetriNet/Place",
+                            "PetriNet/Place",
+                        "instantiate",
+                            "Association",
+                            "EPN2PN_transition_link",
+                            "Encapsulated_PetriNet/Transition",
+                            "PetriNet/Transition",
+                        "exit",
+                "transformation_RAMify",
+                    "__merged_All_RAM",
+                    "All_RAM",
+                "transformation_add_MANUAL",
+                    "Requirements",
+                    "",
+                    "Requirements",
+                    "",
+                    "revise_req",
+                "transformation_add_MANUAL",
+                    "Requirements",
+                    "PW_Environment",
+                    "",
+                    "PW_Environment",
+                    "",
+                    "revise_environment",
+                "transformation_add_MANUAL",
+                    "Requirements",
+                    "PW_Plant",
+                    "",
+                    "PW_Plant",
+                    "",
+                    "revise_plant",
+                "transformation_add_MANUAL",
+                    "Requirements",
+                    "PW_Control",
+                    "",
+                    "PW_Control",
+                    "",
+                    "revise_control",
+                "transformation_add_MANUAL",
+                    "Requirements",
+                    "Query",
+                    "",
+                    "Query",
+                    "",
+                    "revise_query",
+                "transformation_add_MANUAL",
+                    "Requirements",
+                    "Architecture",
+                    "",
+                    "Architecture",
+                    "",
+                    "revise_architecture",
+                "transformation_add_MT",
+                    "All_RAM",
+                    "",
+                    "PW_Plant",
+                    "PW_Environment",
+                    "PW_Control",
+                    "Query",
+                    "Architecture",
+                    "Requirements",
+                    "",
+                    "make_initial_models",
+                    ] + get_model_constructor_2("models/initialize.mvc") + [
+                "transformation_add_MT",
+                    "All_RAM",
+                    "PW_Plant",
+                    "",
+                    "Encapsulated_PetriNet",
+                    "",
+                    "plant_to_EPN",
+                    ] + get_model_constructor_2("models/plant_to_EPN.mvc") + [
+                "transformation_add_MT",
+                    "All_RAM",
+                    "PW_Control",
+                    "",
+                    "Encapsulated_PetriNet",
+                    "",
+                    "control_to_EPN",
+                    ] + get_model_constructor_2("models/control_to_EPN.mvc") + [
+                "transformation_add_MT",
+                    "All_RAM",
+                    "PW_Environment",
+                    "",
+                    "Encapsulated_PetriNet",
+                    "",
+                    "environment_to_EPN",
+                    ] + get_model_constructor_2("models/environment_to_EPN.mvc") + [
+                "transformation_add_MT",
+                    "All_RAM",
+                    "Encapsulated_PetriNet",
+                    "Architecture",
+                    "",
+                    "Encapsulated_PetriNet",
+                    "",
+                    "combine_EPN",
+                    ] + get_model_constructor_2("models/combine_EPN.mvc") + [
+                "transformation_add_MT",
+                    "All_RAM",
+                    "ReachabilityGraph",
+                    "Query",
+                    "",
+                    "",
+                    "match",
+                    ] + get_model_constructor_2("models/matches.mvc") + [
+                "transformation_add_AL",
+                    "PetriNet",
+                    "",
+                    "ReachabilityGraph",
+                    "",
+                    "reachability",
+                    ] + get_constructor(open("models/reachability.alc", "r").read()) + [
+                "transformation_add_AL",
+                    "PetriNet",
+                    "",
+                    "",
+                    "pn_print",
+                    ] + get_constructor(open("models/pn_print.alc", "r").read()) + [
+                "transformation_add_AL",
+                    "Encapsulated_PetriNet",
+                    "",
+                    "",
+                    "epn_print",
+                    ] + get_constructor(open("models/epn_print.alc", "r").read()) + [
+                "transformation_add_AL",
+                    "ReachabilityGraph",
+                    "",
+                    "",
+                    "bfs",
+                    ] + get_constructor(open("models/bfs.alc", "r").read()) + [
+                "model_list",
+                "process_execute",
+                "pm_powerwindow",
+                "pm_",
+                # revise_req
+                "upload",
+                ] + get_model_constructor_2("models/requirements_model.mvc") + [
+                "exit",
+                # revise_plant
+                "upload",
+                ] + get_model_constructor_2("models/plant_model.mvc") + [
+                "exit",
+                # revise_environment
+                "upload",
+                ] + get_model_constructor_2("models/environment_model.mvc") + [
+                "exit",
+                # revise_control
+                "upload",
+                ] + get_model_constructor_2("models/control_model_wrong.mvc") + [
+                "exit",
+                # revise_query
+                "upload",
+                ] + get_model_constructor_2("models/query_model.mvc") + [
+                "exit",
+                # revise_architecture
+                "upload",
+                ] + get_model_constructor_2("models/architecture_model.mvc") + [
+                "exit",
+            ],
+            [   # bootup phase
+                "Desired username for admin user?",
+                "Desired password for admin user?",
+                "Please repeat the password",
+                "Passwords match!",
+                "Welcome to the Model Management Interface v2.0!",
+                "Use the 'help' command for a list of possible commands",
+                "Ready for command...",
+                # model_add * 10
+                ] + [   "Creating new model!",
+                        "Model type?",
+                        "Model name?",
+                        "Waiting for model constructors...",
+                        "Model upload success!",
+                        "Ready for command...", ] * 10 + [
+                # model_list
+                model_list |
+                set([
+                     "  ReachabilityGraph : SimpleClassDiagrams",
+                     "  PetriNet : SimpleClassDiagrams",
+                     "  Encapsulated_PetriNet : SimpleClassDiagrams",
+                     "  PW_Plant : SimpleClassDiagrams",
+                     "  PW_Environment : SimpleClassDiagrams",
+                     "  PW_Control : SimpleClassDiagrams",
+                     "  Requirements : SimpleClassDiagrams",
+                     "  Query : SimpleClassDiagrams",
+                     "  pm_powerwindow : ProcessModel",
+                     "  Architecture : SimpleClassDiagrams",
+                     ]),
+                "Ready for command...",
+                # transformation_add_MT_language
+                "Formalisms to include (terminate with empty string)?",
+                "Name of the RAMified transformation metamodel?",
+                "Ready for command...",
+                # model_modify
+                "Which model do you want to modify?",
+                "Model loaded, ready for commands!",
+                "Use 'help' command for a list of possible commands",
+                "Please give your command.",
+                # instantiate * 7
+                ] + [   "Type to instantiate?",
+                        "Name of new element?",
+                        "Source name?",
+                        "Destination name?",
+                        "Instantiation successful!",
+                        "Please give your command.", ] * 7 + [
+                "Ready for command...",
+                # transformation_RAMify
+                "Which metamodel do you want to RAMify?",
+                "Where do you want to store the RAMified metamodel?",
+                "Ready for command...",
+                # transformation_add_MANUAL * 6
+                ] + [
+                    "Which metamodels do you want to use as source for the manual operation (empty string to finish)?",
+                    "Which metamodels do you want to use as target for the manual operation (empty string to finish)?",
+                    "Name of Manual operation model?",
+                    "Ready for command...",
+                    ] * 6 + [
+                # transformation_add_MT * 6
+                ] + [
+                    "RAMified metamodel to use?",
+                    "Supported metamodels:",
+                    set(["  PetriNet",
+                         "  Encapsulated_PetriNet",
+                         "  PW_Plant",
+                         "  Architecture",
+                         "  Query",
+                         "  PW_Environment",
+                         "  Requirements",
+                         "  PW_Control",
+                         "  ReachabilityGraph",
+                        ]),
+                    "",
+                    "Which ones do you want to use as source (empty string to finish)?",
+                    "Which ones do you want to use as target (empty string to finish)?",
+                    "Name of new transformation?",
+                    "Waiting for model constructors...",
+                    "Ready for command...",
+                    ] * 6 + [
+                # transformation_add_AL * 4
+                ] + [   "Which metamodels do you want to use as source for the action code (empty string to finish)?",
+                        "Which metamodels do you want to use as target for the action code (empty string to finish)?",
+                        "Name of Action Language model?",
+                        "Waiting for model constructors...",
+                        "Ready for command...", ] * 4 + [
+                # model_list
+                model_list |
+                set([
+                     "  PetriNet : SimpleClassDiagrams",
+                     "  Encapsulated_PetriNet : SimpleClassDiagrams",
+                     "  PW_Plant : SimpleClassDiagrams",
+                     "  PW_Environment : SimpleClassDiagrams",
+                     "  PW_Control : SimpleClassDiagrams",
+                     "  Requirements : SimpleClassDiagrams",
+                     "  Query : SimpleClassDiagrams",
+                     "  reachability : ActionLanguage",
+                     "  revise_req : ManualOperation",
+                     "  revise_plant : ManualOperation",
+                     "  revise_control : ManualOperation",
+                     "  revise_environment : ManualOperation",
+                     "  revise_query : ManualOperation",
+                     "  revise_architecture : ManualOperation",
+                     "  __merged_revise_req : SimpleClassDiagrams",
+                     "  __merged_All_RAM : SimpleClassDiagrams",
+                     "  __merged_revise_plant : SimpleClassDiagrams",
+                     "  __merged_revise_control : SimpleClassDiagrams",
+                     "  __merged_revise_environment : SimpleClassDiagrams",
+                     "  __merged_revise_query : SimpleClassDiagrams",
+                     "  __merged_revise_architecture : SimpleClassDiagrams",
+                     "  pn_print : ActionLanguage",
+                     "  epn_print : ActionLanguage",
+                     "  match : All_RAM",
+                     "  All_RAM : SimpleClassDiagrams",
+                     "  make_initial_models : All_RAM",
+                     "  pm_powerwindow : ProcessModel",
+                     "  plant_to_EPN : All_RAM",
+                     "  combine_EPN : All_RAM",
+                     "  environment_to_EPN : All_RAM",
+                     "  control_to_EPN : All_RAM",
+                     "  ReachabilityGraph : SimpleClassDiagrams",
+                     "  Architecture : SimpleClassDiagrams",
+                     "  bfs : ActionLanguage",
+                     ]),
+                "Ready for command...",
+                # process_execute
+                "Which process model do you want to execute?",
+                "Model prefix to use?",
+                # Manual transformation revise_req
+                "Please perform manual transformation \"revise_req\"",
+                "Model loaded, ready for commands!",
+                "Use 'help' command for a list of possible commands",
+                "Please give your command.",
+                "Waiting for model constructors...",
+                "Please give your command.",
+                # Manual transformation revise_plant
+                "Please perform manual transformation \"revise_plant\"",
+                "Model loaded, ready for commands!",
+                "Use 'help' command for a list of possible commands",
+                "Please give your command.",
+                "Waiting for model constructors...",
+                "Please give your command.",
+                # Manual transformation revise_environment
+                "Please perform manual transformation \"revise_environment\"",
+                "Model loaded, ready for commands!",
+                "Use 'help' command for a list of possible commands",
+                "Please give your command.",
+                "Waiting for model constructors...",
+                "Please give your command.",
+                # Manual transformation revise_control
+                "Please perform manual transformation \"revise_control\"",
+                "Model loaded, ready for commands!",
+                "Use 'help' command for a list of possible commands",
+                "Please give your command.",
+                "Waiting for model constructors...",
+                "Please give your command.",
+                # Manual transformation revise_query
+                "Please perform manual transformation \"revise_query\"",
+                "Model loaded, ready for commands!",
+                "Use 'help' command for a list of possible commands",
+                "Please give your command.",
+                "Waiting for model constructors...",
+                "Please give your command.",
+                # Manual transformation revise_architecture
+                "Please perform manual transformation \"revise_architecture\"",
+                "Model loaded, ready for commands!",
+                "Use 'help' command for a list of possible commands",
+                "Please give your command.",
+                "Waiting for model constructors...",
+                "Please give your command.",
+                # Computations happen without output
+                # Finished, so we go back to the start
+                "Ready for command...",
+            ]))

+ 4 - 35
models/pm_req_analyse.mvc

@@ -30,22 +30,13 @@ ProcessModel analyse_requirements {
     Exec plant_to_EPN {
         name = "plant_to_EPN"
     }
-    Exec print_plant_EPN{
-        name = "epn_print"
-    }
     Exec environment_to_EPN {
         name = "environment_to_EPN"
     }
-    Exec print_env_EPN{
-        name = "epn_print"
-    }
 
     Exec control_to_EPN {
         name = "control_to_EPN"
     }
-    Exec print_control_EPN{
-        name = "epn_print"
-    }
 
     Join join2 {}
 
@@ -53,10 +44,6 @@ ProcessModel analyse_requirements {
         name = "combine_EPN"
     }
 
-    Exec print_pn {
-        name = "pn_print"
-    }
-
     Exec EPN_to_PN {
         name = "EPN_to_PN"
     }
@@ -137,16 +124,12 @@ ProcessModel analyse_requirements {
     Next (revise_plant, plant_to_EPN) {}
     Next (revise_environment, environment_to_EPN) {}
     Next (revise_control, control_to_EPN) {}
-    Next (plant_to_EPN, print_plant_EPN) {}
-    Next (print_plant_EPN, join2) {}
-    Next (environment_to_EPN, print_env_EPN) {}
-    Next (print_env_EPN, join2) {}
-    Next (control_to_EPN, print_control_EPN) {}
-    Next (print_control_EPN, join2) {}
+    Next (plant_to_EPN, join2) {}
+    Next (environment_to_EPN, join2) {}
+    Next (control_to_EPN, join2) {}
     Next (revise_architecture, join2) {}
     Next (join2, combine_EPN) {}
-    Next (combine_EPN, print_pn) {}
-    Next (print_pn, analyse) {}
+    Next (combine_EPN, analyse) {}
     Next (analyse, join3) {}
     Next (revise_query, join3) {}
     Next (join3, match) {}
@@ -265,18 +248,4 @@ ProcessModel analyse_requirements {
     Consumes (bfs, reachability_graph) {
         name = "reachability_graph"
     }
-
-    Consumes (print_pn, pn) {
-        name = "pn"
-    }
-
-    Consumes (print_plant_EPN, plant_EPN){
-        name = "epn"
-    }
-    Consumes (print_control_EPN, control_EPN){
-        name = "epn"
-    }
-    Consumes (print_env_EPN, environment_EPN){
-        name = "epn"
-    }
 }