Explorar o código

Fixed bugs in previous commit, where some parts didn't completely use names yet

Yentl Van Tendeloo %!s(int64=9) %!d(string=hai) anos
pai
achega
a5a1b12bdf
Modificáronse 3 ficheiros con 10 adicións e 3 borrados
  1. 2 0
      bootstrap/conformance_scd.alc
  2. 7 2
      bootstrap/modelling.alc
  3. 1 1
      integration/utils.py

+ 2 - 0
bootstrap/conformance_scd.alc

@@ -169,6 +169,7 @@ String function conformance_scd(model : Element):
 						if (integer_lt(cardinalities[check_type]["suc"], instances)):
 							return "Upper cardinality violation for incoming edge at " + model_name
 
+	log("Finished, checking multiplicities at the end")
 	// Check multiplicities, if they are defined (optional)
 	Element metamodel_keys
 	String metamodel_element
@@ -177,6 +178,7 @@ String function conformance_scd(model : Element):
 	metamodel_keys = dict_keys(metamodel["model"])
 	while (0 < list_len(metamodel_keys)):
 		metamodel_element = set_pop(metamodel_keys)
+		log("Check " + metamodel_element)
 
 		// Lower multiplicities
 		attr_value = read_attribute(metamodel, metamodel_element, "lower_cardinality")

+ 7 - 2
bootstrap/modelling.alc

@@ -91,7 +91,7 @@ String function instantiate_node(model : Element, type_name : String, instance_n
 	return actual_name
 
 String function find_attribute_type(model : Element, elem : String, name : String):
-	Element mm_elem
+	String mm_elem
 	String direct_type
 
 	direct_type = getName(model["metamodel"], dict_read_node(model["type_mapping"], model["model"][elem]))
@@ -101,7 +101,7 @@ String function find_attribute_type(model : Element, elem : String, name : Strin
 		// Couldn't find element, so is not allowed!
 		return ""
 	else:
-		return getName(model["metamodel"], dict_read_edge(model["metamodel"][mm_elem], name))
+		return getName(model["metamodel"], dict_read_edge(model["metamodel"]["model"][mm_elem], name))
 
 Element function get_superclasses(model : Element, name : String):
 	Element result
@@ -154,6 +154,11 @@ Void function instantiate_attribute(model : Element, element : String, attribute
 	String attr_name
 
 	attr_type = find_attribute_type(model, element, attribute_name)
+
+	if (attr_type == ""):
+		log("Could not find attribute!")
+		return
+		
 	attr_name = model_add_value(model, "", value)
 	retype(model, attr_name, getName(model["metamodel"], read_edge_dst(model["metamodel"]["model"][attr_type])))
 	instantiate_link(model, attr_type, "", element, attr_name)

+ 1 - 1
integration/utils.py

@@ -274,7 +274,7 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
                         # Modelverse has already terminated, which isn't a good sign!
                         return False
 
-                    val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=30).read()
+                    val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=45).read()
                 except:
                     if timeout:
                         return True