Jelajahi Sumber

Test the "types" operation

Yentl Van Tendeloo 7 tahun lalu
induk
melakukan
9ce1af26bb

+ 0 - 2
bootstrap/conformance_finding.alc

@@ -99,14 +99,12 @@ Boolean function find_type_mapping(model : Element):
 
 			if (readAssociationSource(model["metamodel"], main_edge) == small_edge):
 				// Switch both
-				log("Switch")
 				String tmp
 				tmp = main_edge
 				main_edge = small_edge
 				small_edge = tmp
 
 			if (readAssociationSource(model["metamodel"], small_edge) == main_edge):
-				log("Dictionary working...")
 				String origin
 				String value
 				String key

+ 39 - 2
unit/test_all.py

@@ -763,6 +763,45 @@ class TestModelverse(unittest.TestCase):
         except ReadPermissionDenied:
             pass
 
+    def test_op_types(self):
+        # Try operation of unopened model
+        assert types("formalisms/ProcessModel") == element_list("formalisms/SimpleClassDiagrams")
+
+        # Try simple operation
+        model_add("users/user/test/a", "formalisms/ProcessModel", """
+            Start start {}
+            Finish finish {}
+            Next nxt (start, finish) {}
+            """)
+
+        assert types("users/user/test/a") == element_list("formalisms/ProcessModel")
+        alter_context("users/user/test/a", "formalisms/Bottom")
+        assert types("users/user/test/a") == element_list("formalisms/Bottom")
+
+        # Try for model that we cannot read
+        try:
+            types("administration/core")
+            self.fail()
+        except ReadPermissionDenied:
+            pass
+        
+        # Try for non-existing model
+        try:
+            types("a")
+            self.fail()
+        except UnknownModel:
+            pass
+
+        # Try for a metamodel that we are not allowed to read, although the model may be read
+        model_add("users/user/test/b", "formalisms/SimpleClassDiagrams")
+        assert types("users/user/test/b") == element_list("formalisms/SimpleClassDiagrams")
+        alter_context("users/user/test/b", "administration/core")
+        try:
+            types("users/user/test/b")
+            self.fail()
+        except ReadPermissionDenied:
+            pass
+
     """
     def test_op_model_render(self):
     def test_op_transformation_between(self):
@@ -785,8 +824,6 @@ class TestModelverse(unittest.TestCase):
     def test_op_group_list(self):
     def test_op_conformance_delete(self):
     def test_op_conformance_add(self):
-    def test_op_types(self):
-    def test_op_types_full(self):
     def test_op_read_info(self):
     def test_op_read_attrs(self):
     def test_op_instantiate(self):

+ 0 - 1
wrappers/classes/modelverse.xml

@@ -1959,7 +1959,6 @@
                             <transition cond="self.expect_action('all_instances')" target="../../../operations/all_instances">
                                 <script>
                                     self.load_action()
-                                    print("Load all_instances for " + str(self.parameters))
                                 </script>
                             </transition>
 

+ 0 - 1
wrappers/modelverse_SCCD.py

@@ -2394,7 +2394,6 @@ class Modelverse(RuntimeClassBase):
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_21_exec(self, parameters):
         self.load_action()
-        print("Load all_instances for " + str(self.parameters))
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_21_guard(self, parameters):
         return self.expect_action('all_instances')