Skip to content

Commit b2a63c6

Browse files
adding message for incorrect case (#1228)
1 parent a1a50d5 commit b2a63c6

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

integration-tests/alias-test/generate/src/test/python/aliastest/generate/generator_offline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,14 @@ def create_security_type(self, mbean_type):
419419

420420
singular = mbean_type
421421
if singular.endswith('s'):
422+
# FIXME - This doesn't seem very rigorous, e.g., directories => directory
422423
lenm = len(mbean_type)-1
423424
singular = mbean_type[0:lenm]
424425
for item in types:
425426
idx = item.rfind('.')
426427
short = item[idx + 1:]
427428
package = short
428-
mbean_instance = generator_wlst.created_security_provider(singular, short, package)
429+
mbean_instance = generator_wlst.create_security_provider(singular, short, package)
429430
orig = generator_wlst.current_path()
430431
folder_dict[short] = PyOrderedDict()
431432
folder_dict[short][ATTRIBUTES] = self.__get_attributes(mbean_instance)

integration-tests/alias-test/generate/src/test/python/aliastest/generate/generator_online.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def generate_security_mbean(self, dictionary, mbean_type):
325325
short = item[idx + 1:]
326326
orig = generator_wlst.current_path()
327327
if short not in existing:
328-
mbean_instance = generator_wlst.created_security_provider(mbean_type, short, item)
328+
mbean_instance = generator_wlst.create_security_provider(mbean_type, short, item)
329329
generator_wlst.cd_mbean(curr_path + '/' + mbean_type + '/' + short)
330330
else:
331331
mbean_instance = generator_wlst.get_mbean_proxy(curr_path + '/' + mbean_type + '/' + short)

integration-tests/alias-test/generate/src/test/python/aliastest/generate/generator_wlst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def created(mbean_type, name):
242242
return True
243243

244244

245-
def created_security_provider(mbean_type, name, package):
245+
def create_security_provider(mbean_type, name, package):
246246
"""
247247
Create the MBean with the provided name at the current wlst location. WLST Exceptions are caught and returned
248248
as False from the method.

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,10 @@ def _does_alias_attribute_exist(self, location, generated_attribute, generated_a
535535
message = 'Since Version=', generated_attribute_info[SINCE_VERSION]
536536

537537
if generated_attribute.lower() in lower_case_list:
538-
self._add_error(location, ERROR_ATTRIBUTE_INCORRECT_CASE, attribute=generated_attribute)
538+
expected_wlst_name = _get_dict_key_from_value(alias_name_map, generated_attribute.lower())
539+
message = 'WLST name in aliases is %s' % expected_wlst_name
540+
self._add_error(location, ERROR_ATTRIBUTE_INCORRECT_CASE,
541+
message=message, attribute=generated_attribute)
539542
elif self._is_generated_attribute_readonly(location, generated_attribute, generated_attribute_info):
540543
self._add_error(location, ERROR_ATTRIBUTE_ALIAS_NOT_FOUND_IS_READONLY,
541544
attribute=generated_attribute, message=message)
@@ -1457,6 +1460,15 @@ def _type_can_be_lsa_string(attribute_type):
14571460
attribute_type in alias_constants.ALIAS_MAP_TYPES
14581461

14591462

1463+
def _get_dict_key_from_value(alias_name_map, lower_case_value):
1464+
result = None
1465+
for key, value in alias_name_map.iteritems():
1466+
if value == lower_case_value:
1467+
result = key
1468+
break
1469+
return result
1470+
1471+
14601472
class VerifierResult(object):
14611473
CLASS_NAME = 'VerifierResult'
14621474

0 commit comments

Comments
 (0)