4949from wlsdeploy .aliases .alias_constants import WLST_SUBFOLDERS_PATH
5050from wlsdeploy .aliases .alias_constants import WLST_TYPE
5151
52+ from wlsdeploy .exception .expection_types import ExceptionType
53+ from wlsdeploy .tool .util .attribute_setter import AttributeSetter
5254
5355class ListTestCase (unittest .TestCase ):
5456 _resources_dir = '../../test-classes/'
@@ -496,18 +498,33 @@ def _verify_attribute_set_method_attribute_value(self, folder_name, attribute_na
496498 SET_METHOD , alias_attribute_value )
497499 result .append (message )
498500 else :
499- offline_value = self .alias_entries ._resolve_curly_braces (alias_attribute_value )
500- if len (offline_value ) > 0 and not offline_value .startswith ('MBEAN' ):
501- message = self ._get_invalid_alias_attribute_value_message (folder_name , attribute_name , SET_METHOD ,
502- 'offline' , offline_value ,
503- 'it does not start with MBEAN' )
504- result .append (message )
505- online_value = self .alias_entries ._resolve_curly_braces (alias_attribute_value )
506- if offline_value != online_value and len (online_value ) > 0 and not online_value .startswith ('MBEAN' ):
501+ result .extend (self ._verify_attribute_set_method (folder_name , attribute_name , WlstModes .OFFLINE ,
502+ alias_attribute_value , self .alias_entries ))
503+ result .extend (self ._verify_attribute_set_method (folder_name , attribute_name , WlstModes .ONLINE ,
504+ alias_attribute_value , self .online_alias_entries ))
505+ return result
506+
507+ def _verify_attribute_set_method (self , folder_name , attribute_name , wlst_mode , attribute_value , aliases ):
508+ result = []
509+ resolved_attribute = aliases ._resolve_curly_braces (attribute_value )
510+ if resolved_attribute :
511+ if not resolved_attribute .startswith ('MBEAN' ):
507512 message = self ._get_invalid_alias_attribute_value_message (folder_name , attribute_name , SET_METHOD ,
508- 'online' , online_value ,
513+ WlstModes .from_value (wlst_mode ),
514+ resolved_attribute ,
509515 'it does not start with MBEAN' )
510516 result .append (message )
517+ else :
518+ set_method_value_components = resolved_attribute .split ('.' )
519+ if len (set_method_value_components ) == 2 :
520+ invoker = set_method_value_components [1 ]
521+
522+ instance = AttributeSetter (aliases , None , ExceptionType .ALIAS , wlst_mode )
523+ try :
524+ getattr (instance , invoker )
525+ except AttributeError :
526+ result .append (self .set_method_not_found_message (folder_name , attribute_name ,
527+ WlstModes .from_value (wlst_mode ), invoker ))
511528 return result
512529
513530 def _verify_attribute_uses_path_tokens_attribute_value (self , folder_name , attribute_name , alias_attribute_value ):
@@ -750,3 +767,8 @@ def _get_invalid_alias_attribute_value_message(self, folder_name, attribute_name
750767 text = 'Folder at path %s has a defined attribute %s with alias attribute %s whose ' \
751768 '%s value %s was not valid because %s'
752769 return text % (folder_name , attribute_name , alias_attribute_name , wlst_mode , alias_attribute_value , cause )
770+
771+ def set_method_not_found_message (self , folder_name , attribute_name , wlst_mode , alias_attribute_value ):
772+ text = 'Folder at path %s has a %s defined attribute %s whose set_method %s was not found in the' \
773+ ' attribute setter class'
774+ return text % (folder_name , attribute_name , wlst_mode , alias_attribute_value )
0 commit comments