123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- import unittest
- from utils import run_file, get_constructor, get_raw_model_constructor
- all_files = [ "core/mini_modify.alc",
- "core/core_formalism.mvc",
- "core/core_algorithm.alc",
- "primitives.alc",
- "object_operations.alc",
- "conformance_scd.alc",
- "library.alc",
- "ftg.alc",
- "transform.alc",
- "model_management.alc",
- "ramify.alc",
- "metamodels.alc",
- "random.alc",
- "constructors.alc",
- "modelling.alc",
- "compilation_manager.alc",
- ]
- class TestModelverseCore(unittest.TestCase):
- def test_po_list(self):
- self.list("PO")
- def list(self, mode):
- self.assertTrue(run_file(all_files,
- [ "root",
- "model_list",
- ],
- [ "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...",
- set([" SimpleClassDiagrams : SimpleClassDiagrams",
- " CoreFormalism : SimpleClassDiagrams",
- " core : CoreFormalism"]),
- ],
- mode))
- def test_po_list_full(self):
- self.list_full("PO")
- def list_full(self, mode):
- self.assertTrue(run_file(all_files,
- [ "root",
- "model_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...",
- set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
- " 221 root admin 86 CoreFormalism : SimpleClassDiagrams",
- " 200 root admin 43 core : CoreFormalism"]),
- ],
- mode))
- def test_po_model_add_empty(self):
- self.model_add_empty("PO")
- def model_add_empty(self, mode):
- self.assertTrue(run_file(all_files,
- [ "root",
- "model_add",
- "SimpleClassDiagrams",
- "Empty",
- "exit",
- "model_list",
- "model_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([" SimpleClassDiagrams : SimpleClassDiagrams",
- " CoreFormalism : SimpleClassDiagrams",
- " Empty : SimpleClassDiagrams",
- " core : CoreFormalism"]),
- "Ready for command...",
- set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
- " 221 root admin 86 CoreFormalism : SimpleClassDiagrams",
- " 200 root nobody 0 Empty : SimpleClassDiagrams",
- " 200 root admin 53 core : CoreFormalism"]),
- ],
- mode))
- def test_po_model_empty_modify(self):
- self.model_empty_modify("PO")
- def model_empty_modify(self, mode):
- self.assertTrue(run_file(all_files,
- [ "root",
- "model_add",
- "SimpleClassDiagrams",
- "Empty",
- "exit",
- "model_list",
- "model_list_full",
- "model_modify",
- "Empty",
- "instantiate",
- "Class",
- "A",
- "exit",
- "model_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([" SimpleClassDiagrams : SimpleClassDiagrams",
- " CoreFormalism : SimpleClassDiagrams",
- " Empty : SimpleClassDiagrams",
- " core : CoreFormalism"]),
- "Ready for command...",
- set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
- " 221 root admin 86 CoreFormalism : SimpleClassDiagrams",
- " 200 root nobody 0 Empty : SimpleClassDiagrams",
- " 200 root admin 53 core : CoreFormalism"]),
- "Ready for command...",
- "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.",
- "Type to instantiate?",
- "Name of new element?",
- "Instantiation successful!",
- "Please give your command.",
- "Ready for command...",
- set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
- " 221 root admin 86 CoreFormalism : SimpleClassDiagrams",
- " 200 root nobody 1 Empty : SimpleClassDiagrams",
- " 200 root admin 53 core : CoreFormalism"]),
- "Ready for command...",
- ],
- mode))
- def test_po_model_overwrite(self):
- self.model_overwrite("PO")
- def model_overwrite(self, mode):
- self.assertTrue(run_file(all_files,
- [ "root",
- "model_add",
- "SimpleClassDiagrams",
- "Empty",
- "exit",
- "model_list_full",
- "model_modify",
- "Empty",
- "instantiate",
- "Class",
- "A",
- "exit",
- "model_list_full",
- "model_overwrite",
- "Empty",
- "instantiate_node",
- "Class",
- "B",
- "instantiate_node",
- "Class",
- "C",
- "exit",
- "model_list_full",
- "model_modify",
- "Empty",
- "list",
- "exit",
- ],
- [ "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 0 Empty : SimpleClassDiagrams",
- " 200 root admin 53 core : CoreFormalism"]),
- "Ready for command...",
- "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.",
- "Type to instantiate?",
- "Name of new element?",
- "Instantiation successful!",
- "Please give your command.",
- "Ready for command...",
- set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
- " 221 root admin 86 CoreFormalism : SimpleClassDiagrams",
- " 200 root nobody 1 Empty : SimpleClassDiagrams",
- " 200 root admin 53 core : CoreFormalism"]),
- "Ready for command...",
- "Which model to overwrite?",
- "Waiting for model constructors...",
- "Model overwrite success!",
- "Ready for command...",
- set([" 221 root admin 673 SimpleClassDiagrams : SimpleClassDiagrams",
- " 221 root admin 86 CoreFormalism : SimpleClassDiagrams",
- " 200 root nobody 2 Empty : SimpleClassDiagrams",
- " 200 root admin 53 core : CoreFormalism"]),
- "Ready for command...",
- "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.",
- "List of all elements:",
- set([" B : Class",
- " C : Class"]),
- "Please give your command.",
- "Ready for command...",
- ],
- mode))
- def test_po_transform_add_MT_language(self):
- self.transform_add_MT_language("PO")
- def transform_add_MT_language(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",
- ],
- [ "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 76 core : CoreFormalism"]),
- "Ready for command...",
- ],
- mode))
- def test_po_transform_add_MT_instance(self):
- self.transform_add_MT_instance("PO")
- def transform_add_MT_instance(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",
- ],
- [ "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)?",
- "Model added as target",
- "Name of new transformation?",
- "Met-info correctly set!",
- 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...",
- "Merged metamodel to RAMify again?",
- "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...",
- ],
- mode))
|