Skip to content

Commit ed4884b

Browse files
fixing an issue with the wlst_read_type not being properly matched (#1225)
1 parent 23b7af2 commit ed4884b

File tree

1 file changed

+48
-16
lines changed
  • integration-tests/alias-test/verify/src/test/python/aliastest/verify

1 file changed

+48
-16
lines changed

integration-tests/alias-test/verify/src/test/python/aliastest/verify/verifier.py

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,15 +1056,19 @@ def _check_complex_type(self, location, generated_attribute, generated_attr_info
10561056
:return: True if the delimited type contains properties
10571057
"""
10581058
_method_name = '_check_complex_type'
1059-
_logger.entering(generated_attribute, alias_type, model_name,
1059+
_logger.entering(location.get_folder_path(), generated_attribute, alias_type, model_name,
10601060
class_name=CLASS_NAME, method_name=_method_name)
10611061

10621062
valid = False
10631063
lsa_type, get_type, cmo_type = _get_attribute_types(generated_attr_info)
1064-
_logger.finest('Attribute {0} lsa_type {1} cmo_type {2} get_type {3} : alias_type {4} get required {5}',
1065-
generated_attribute, lsa_type, cmo_type, get_type, alias_type,
1066-
Boolean(generated_attribute in get_required_attribute_list),
1067-
class_name=CLASS_NAME, method_name=_method_name)
1064+
if _logger.is_finest_enabled():
1065+
wlst_read_type = self._alias_helper.get_wlst_read_type(location, model_name)
1066+
_logger.finest('Location {0} Attribute {1} with alias_type {2}: lsa_type={3} cmo_type={4}'
1067+
' get_type={5} wlst_read_type={6}, get_required={7}',
1068+
location.get_folder_path(), generated_attribute, alias_type, lsa_type, cmo_type, get_type,
1069+
wlst_read_type, Boolean(generated_attribute in get_required_attribute_list),
1070+
class_name=CLASS_NAME, method_name=_method_name)
1071+
10681072
if alias_type == alias_constants.SEMI_COLON_DELIMITED_STRING and \
10691073
_is_of_type_with_lsa(generated_attribute, alias_constants.PROPERTIES, generated_attr_info,
10701074
get_required_attribute_list):
@@ -1083,6 +1087,9 @@ def _check_complex_type(self, location, generated_attribute, generated_attr_info
10831087
alias_constants.ALIAS_DELIMITED_TYPES:
10841088
self._add_invalid_type_error(location, generated_attribute, alias_constants.STRING, alias_type,
10851089
get_required_attribute_list, 'GET or WLST_READ_TYPE required')
1090+
elif _is_wlst_read_type_compatible_list_type(generated_attribute, lsa_type,
1091+
self._alias_helper.get_wlst_read_type(location, model_name)):
1092+
valid = True
10861093
elif alias_type == alias_constants.LIST:
10871094
if _is_of_type_with_get_required(generated_attribute, alias_type, generated_attr_info,
10881095
get_required_attribute_list):
@@ -1094,6 +1101,9 @@ def _check_complex_type(self, location, generated_attribute, generated_attr_info
10941101
alias_constants.ALIAS_DELIMITED_TYPES:
10951102
self._add_invalid_type_error(location, generated_attribute, alias_constants.STRING, alias_type,
10961103
get_required_attribute_list, 'LSA GET_METHOD requires WLST_READ_TYPE')
1104+
elif _is_wlst_read_type_compatible_list_type(generated_attribute, lsa_type,
1105+
self._alias_helper.get_wlst_read_type(location, model_name)):
1106+
valid = True
10971107
elif alias_type in alias_constants.ALIAS_DELIMITED_TYPES:
10981108
if _is_any_string_type(generated_attr_info):
10991109
valid = True
@@ -1232,24 +1242,46 @@ def _get_attribute_types(attribute_info):
12321242
return lsa_type, get_type, cmo_type
12331243

12341244

1235-
def _is_of_type_with_lsa(attribute, alias_type, attribute_info, get_required_attribute_list):
1245+
def _is_of_type_with_get_required(attribute, alias_type, attribute_info, get_required_attribute_list):
12361246
lsa_type, get_type, cmo_type = _get_attribute_types(attribute_info)
1237-
return attribute not in get_required_attribute_list and lsa_type is not None and \
1238-
(lsa_type == alias_type or
1239-
((_is_type_an_unknown_type(lsa_type) or lsa_type == alias_constants.STRING or
1240-
lsa_type == alias_constants.INTEGER) and
1241-
((_is_type_an_unknown_type(get_type) and cmo_type is None) or (get_type == alias_type
1242-
or cmo_type == alias_type))))
1247+
return attribute in get_required_attribute_list and (get_type == alias_type or cmo_type == alias_type)
12431248

12441249

1245-
def _is_in_types_with_get_required(attribute, alias_types, attribute_info, get_required_attribute_list):
1250+
def _is_of_type_with_lsa(attribute, alias_type, attribute_info, get_required_attribute_list):
12461251
lsa_type, get_type, cmo_type = _get_attribute_types(attribute_info)
1247-
return attribute in get_required_attribute_list and (get_type in alias_types or cmo_type in alias_types)
12481252

1253+
is_lsa_type = attribute not in get_required_attribute_list and lsa_type is not None
1254+
is_lsa_and_alias_types_equal = lsa_type == alias_type
1255+
is_lsa_type_unknown = _is_type_an_unknown_type(lsa_type)
1256+
is_lsa_type_string_or_integer = lsa_type == alias_constants.STRING or lsa_type == alias_constants.INTEGER
1257+
is_lsa_type_unknown_or_string_or_integer = is_lsa_type_unknown or is_lsa_type_string_or_integer
1258+
is_lsa_type_unknown_and_cmo_type_is_none = _is_type_an_unknown_type(get_type) and cmo_type is None
1259+
is_get_and_alias_types_equal = get_type == alias_type
1260+
is_cmo_and_alias_types_equal = cmo_type == alias_type
1261+
is_cmo_or_get_and_alias_types_equal = is_get_and_alias_types_equal or is_cmo_and_alias_types_equal
12491262

1250-
def _is_of_type_with_get_required(attribute, alias_type, attribute_info, get_required_attribute_list):
1263+
return is_lsa_type and \
1264+
(is_lsa_and_alias_types_equal or
1265+
(is_lsa_type_unknown_or_string_or_integer and
1266+
(is_lsa_type_unknown_and_cmo_type_is_none or is_cmo_or_get_and_alias_types_equal)))
1267+
1268+
1269+
def _is_wlst_read_type_compatible_list_type(attribute, lsa_type, wlst_read_type):
1270+
_method_name = '_is_wlst_read_type_compatible_list_type'
1271+
_logger.entering(attribute, lsa_type, wlst_read_type, class_name=CLASS_NAME, method_name=_method_name)
1272+
1273+
result = False
1274+
if wlst_read_type is not None and lsa_type is not None:
1275+
# if the lsa_type is 'string' and the wlst_read_type is 'delimited_string[*]', the types are a match
1276+
result = wlst_read_type in alias_constants.ALIAS_DELIMITED_TYPES and lsa_type in wlst_read_type
1277+
1278+
_logger.exiting(class_name=CLASS_NAME, method_name=_method_name, result=result)
1279+
return result
1280+
1281+
1282+
def _is_in_types_with_get_required(attribute, alias_types, attribute_info, get_required_attribute_list):
12511283
lsa_type, get_type, cmo_type = _get_attribute_types(attribute_info)
1252-
return attribute in get_required_attribute_list and (get_type == alias_type or cmo_type == alias_type)
1284+
return attribute in get_required_attribute_list and (get_type in alias_types or cmo_type in alias_types)
12531285

12541286

12551287
def _check_for_allowed_unknowns(location, generated_attribute, wlst_type, alias_type, generated_attr_info,

0 commit comments

Comments
 (0)