123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- import unittest
- from utils import run_file, get_constructor, get_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))
|