Quellcode durchsuchen

Added in model constructors for the add_MT call

Yentl Van Tendeloo vor 8 Jahren
Ursprung
Commit
a2347347f0
2 geänderte Dateien mit 81 neuen und 3 gelöschten Zeilen
  1. 2 3
      core/core_algorithm.alc
  2. 79 0
      integration/test_mvc.py

+ 2 - 3
core/core_algorithm.alc

@@ -357,7 +357,6 @@ Void function user_function_skip_init(user_id : String):
 						// Model doesn't exist yet
 						output("Waiting for model constructors...")
 
-						// TODO Update construct_model call to this interface
 						new_model = construct_model_raw(import_node(read_attribute(core, type_id, "location")))
 						model_create(new_model, name, user_id, type_id, "Model")
 						output("Model upload success!")
@@ -744,8 +743,8 @@ Void function user_function_skip_init(user_id : String):
 					if (get_model_id(name) == ""):
 						String new_model
 						// Finished with all information, now create the model itself!
-						new_model = instantiate_model(import_node(read_attribute(core, ramified_metamodel_id, "location")))
-
+						output("Waiting for model constructors...")
+						new_model = construct_model_raw(import_node(read_attribute(core, ramified_metamodel_id, "location")))
 						model_create(new_model, name, user_id, ramified_metamodel_id, "ModelTransformation")
 						model_id = get_model_id(name)
 

+ 79 - 0
integration/test_mvc.py

@@ -299,10 +299,89 @@ class TestModelverseCore(unittest.TestCase):
                 "",
                 "",
                 "PetriNets_Print",
+                "exit",
                 "model_list_full",
                 "transformation_list",
                 "transformation_list_full",
             ],
+            [   "Desired username for admin user?",
+                "Welcome to the Model Management Interface v2.0!",
+                "Use the 'help' command for a list of possible commands",
+                "Ready for command...",
+                "Creating new model!",
+                "Model type?",
+                "Model name?",
+                "Waiting for model constructors...",
+                "Model upload success!",
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    14   PetriNets : SimpleClassDiagrams",
+                     "  200  root admin    53   core : CoreFormalism"]),
+                "Ready for command...",
+                "Formalisms to include (terminate with empty string)?",
+                "Name of the RAMified transformation metamodel?",
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    14   PetriNets : SimpleClassDiagrams",
+                     "  200  root nobody    14   __merged_PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root nobody    328   PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root admin    79   core : CoreFormalism"]),
+                "Ready for command...",
+                "RAMified metamodel to use?",
+                "Supported metamodels:",
+                set(["  PetriNets",
+                    ]),
+                "",
+                "Which ones do you want to use as source (empty string to finish)?",
+                "Model added as source",
+                "Which ones do you want to use as target (empty string to finish)?",
+                "Name of new transformation?",
+                "Waiting for model constructors...",
+                "Meta-info correctly set!",
+                "Ready for command...",
+                set(["  221  root admin    673   SimpleClassDiagrams : SimpleClassDiagrams",
+                     "  221  root admin    86   CoreFormalism : SimpleClassDiagrams",
+                     "  200  root nobody    14   PetriNets : SimpleClassDiagrams",
+                     "  200  root nobody    14   __merged_PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root nobody    328   PetriNets_RAM : SimpleClassDiagrams",
+                     "  200  root nobody    0   PetriNets_Print : PetriNets_RAM",
+                     "  200  root admin    90   core : CoreFormalism"]),
+                "Ready for command...",
+                set(["[ModelTransformation] PetriNets_Print : PetriNets_RAM",
+                    ]),
+                "Ready for command...",
+                set(["  200  root nobody    0   [ModelTransformation] PetriNets_Print : PetriNets_RAM"
+                    ]),
+                "Ready for command...",
+            ],
+            mode))
+
+    def test_po_transform_add_MT_pn_print(self):
+        self.transform_add_MT_pn_print("PO")
+
+    def transform_add_MT_pn_print(self, mode):
+        self.assertTrue(run_file(all_files,
+            [ "root",
+                "model_add",
+                "SimpleClassDiagrams",
+                "PetriNets",
+                ] + get_raw_model_constructor(open("integration/code/petrinets.mvc", "r").read()) + [
+                "model_list_full",
+                "transformation_add_MT_language",
+                "PetriNets",
+                "",
+                "PetriNets_RAM",
+                "model_list_full",
+                "transformation_add_MT",
+                "PetriNets_RAM",
+                "PetriNets",
+                "",
+                "",
+                "PetriNets_Print",
+                "exit",
+            ],
             [   "Desired username for admin user?",
                 "Welcome to the Model Management Interface v2.0!",
                 "Use the 'help' command for a list of possible commands",