Browse Source

Fixes to RAMification

Yentl Van Tendeloo 8 years ago
parent
commit
f318f07a35
2 changed files with 8 additions and 6 deletions
  1. 4 4
      bootstrap/core_algorithm.alc
  2. 4 2
      integration/test_mvc.py

+ 4 - 4
bootstrap/core_algorithm.alc

@@ -1351,11 +1351,11 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
 		if (model_id != ""):
 			if (allow_read(user_id, name)):
 				// Check whether or not it is SimpleClassDiagrams
-				mm = read_attribute(core, readAssociationDestination(core, get_instanceOf_link(name)), "name")
+				mm = read_attribute(core, readAssociationDestination(core, get_instanceOf_link(model_id)), "name")
 				if (mm == "SimpleClassDiagrams"):
 					if (bool_not(dict_in(source, key))):
 						dict_add(source, key, model_id)
-						dict_add(to_ramify, key, get_full_model(model_id))
+						set_add(to_ramify, create_tuple(key, get_full_model(model_id)))
 					else:
 						return "Name was already assigned a metamodel: " + key!
 				else:
@@ -1372,12 +1372,12 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
 		model_id = get_model_id(name)
 		if (model_id != ""):
 			if (allow_read(user_id, name)):
-				mm = read_attribute(core, readAssociationDestination(core, get_instanceOf_link(name)), "name")
+				mm = read_attribute(core, readAssociationDestination(core, get_instanceOf_link(model_id)), "name")
 				if (mm == "SimpleClassDiagrams"):
 					if (bool_not(dict_in(target, key))):
 						if (bool_not(dict_in(to_ramify, key))):
 							dict_add(target, key, model_id)
-							dict_add(to_ramify, key, get_full_model(model_id))
+							set_add(to_ramify, create_tuple(key, get_full_model(model_id)))
 						else:
 							return "Name in output cannot have different type than input: " + key!
 					else:

+ 4 - 2
integration/test_mvc.py

@@ -24,6 +24,8 @@ expected_model_full_list = set([("SimpleClassDiagrams", "SimpleClassDiagrams", "
                                 ("conformance_mv", "ActionLanguage", "admin", "admin", "221"),
                                 ("core", "CoreFormalism", "admin", "admin", "200")])
 
+expected_transformation_list = set([("ActionLanguage", "conformance_mv")])
+
 class TestModelverseCore(unittest.TestCase):
     def setUp(self):
         self.proc, self.address = start_mvc()
@@ -75,7 +77,7 @@ class TestModelverseCore(unittest.TestCase):
         assert model_list() == set(list(expected_model_list) + [("PetriNet", "SimpleClassDiagrams"),
                                                                 ("__RAM_print_pn", "SimpleClassDiagrams"),
                                                                 ("print_pn", "__RAM_print_pn")])
-        assert transformation_list() == set([("ModelTransformation", "print_pn")])
+        assert transformation_list() == set(list(expected_transformation_list) + [("ModelTransformation", "print_pn")])
 
     def test_transform_add_MT_pn_print_exec(self):
         log = []
@@ -92,7 +94,7 @@ class TestModelverseCore(unittest.TestCase):
                                                                 ("my_pn", "PetriNet"),
                                                                 ("__RAM_print_pn", "SimpleClassDiagrams"),
                                                                 ("print_pn", "__RAM_print_pn")])
-        assert transformation_list() == set([("ModelTransformation", "print_pn")])
+        assert transformation_list() == set(list(expected_transformation_list) + [("ModelTransformation", "print_pn")])
         assert transformation_execute_MT("print_pn", {"PetriNet": "my_pn"}, {}, callback) == True
 
         assert set(log) == set(['"p1" --> 1',