Skip to content

Commit e0ada9e

Browse files
fixing alias test anomalies (#1245)
1 parent 3d7220d commit e0ada9e

File tree

3 files changed

+51
-35
lines changed

3 files changed

+51
-35
lines changed

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/AppDeployment.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"PlanStagingMode": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "PlanStagingMode", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "${:ROD}"} ],
6868
"RootStagingDir": [ {"version": "[10,)", "wlst_mode": "online", "wlst_name": "RootStagingDir", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "get_method": "GET", "uses_path_tokens": "true", "access": "RO" } ],
6969
"SecurityDDModel": [ {"version": "[10,12.1.2)", "wlst_mode": "both", "wlst_name": "Security${Dd:DD}Model", "wlst_path": "WP001", "default_value": "DDOnly", "wlst_type": "string", "access": "${:ROD}" },
70-
{"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "SecurityDDModel", "wlst_path": "WP001", "default_value": "DDOnly", "wlst_type": "string", "access": "${:ROD}" }],
70+
{"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "SecurityDDModel", "wlst_path": "WP001", "default_value": "${__NULL__:DDOnly}", "wlst_type": "string", "access": "${:ROD}" }],
7171
"SourcePath": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SourcePath", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "${:ROD}", "uses_path_tokens": "true" } ],
7272
"StagingMode": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "StagingMode", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "${:ROD}" }],
7373
"Target": [ {"version": "[10,)", "wlst_mode": "offline", "wlst_name": "Target", "wlst_path": "WP001", "default_value": null, "wlst_type": "delimited_string", "set_method": "MBEAN.set_target_mbeans" },

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@
2222
__logger.set_level(Level.FINER)
2323
CLASS_NAME = 'generate/utils'
2424

25+
OFFLINE_ALIAS_FOLDER_IGNORE_MAP = {
26+
'/': ['ODLConfiguration', 'OHS', 'RCUDbInfo', 'Security', 'UnixMachine', 'WLSRoles',
27+
'WLSUserPasswordCredentialMappings'],
28+
'/ResourceGroupTemplate': ['OHS', 'SystemComponent']
29+
}
30+
31+
ONLINE_ALIAS_FOLDER_IGNORE_MAP = {
32+
'/ResourceGroupTemplate': ['SystemComponents']
33+
}
34+
35+
OFFLINE_TEST_ANOMALIES_MAP = {
36+
'/Application': {
37+
'ModuleType': 'war',
38+
'SourcePath': 'wlsdeploy/applications/get-listen-address-app.war'
39+
},
40+
'/Library': {
41+
'ModuleType': 'war',
42+
'SourcePath': 'wlsdeploy/sharedLibraries/jstl-1.2.war'
43+
}
44+
}
2545

2646
def get_verify_args_map(args):
2747
"""
@@ -200,6 +220,25 @@ def sort_dict(dictionary):
200220
return new_dictionary
201221

202222

223+
def is_alias_folder_in_ignore_list(model_context, location, alias_name):
224+
if model_context.get_target_wlst_mode == WlstModes.ONLINE:
225+
ignore_map = ONLINE_ALIAS_FOLDER_IGNORE_MAP
226+
else:
227+
ignore_map = OFFLINE_ALIAS_FOLDER_IGNORE_MAP
228+
229+
path = location.get_folder_path()
230+
if path in ignore_map and alias_name in ignore_map[path]:
231+
return True
232+
return False
233+
234+
235+
def is_attribute_value_test_anomaly(model_context, location, attribute_name, attribute_value):
236+
anomaly_map = OFFLINE_TEST_ANOMALIES_MAP
237+
path = location.get_folder_path()
238+
return path in anomaly_map and attribute_name in anomaly_map[path] and \
239+
anomaly_map[path][attribute_name] == attribute_value
240+
241+
203242
def _key_in_case_map(key, case_map):
204243
if key in case_map:
205244
return case_map[key]

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

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,6 @@
146146
MESSAGE = 'message'
147147
ATTRIBUTE = 'attribute'
148148

149-
ALIAS_FOLDER_IGNORE_MAP = {
150-
'/': [
151-
'ODLConfiguration',
152-
'OHS',
153-
'RCUDbInfo',
154-
'Security',
155-
'UnixMachine',
156-
'WLSRoles',
157-
'WLSUserPasswordCredentialMappings'
158-
],
159-
'/ResourceGroupTemplate': [
160-
'OHS',
161-
'SystemComponent',
162-
'SystemComponents'
163-
]
164-
}
165-
166149
_logger = PlatformLogger('test.aliases.verify')
167150
_logger.set_level(Level.FINER)
168151
CLASS_NAME = 'Verifier'
@@ -316,7 +299,7 @@ def _check_generated_against_alias_folders(self, location, generated_dictionary,
316299
class_name=CLASS_NAME, method_name=_method_name)
317300
if keys is not None:
318301
for alias_name in keys:
319-
if _is_in_ignore_list(location, alias_name):
302+
if verify_utils.is_alias_folder_in_ignore_list(self._model_context, location, alias_name):
320303
continue
321304

322305
found, mbean_info_name = verify_utils.find_name_in_mbean_with_model_name(alias_name, lower_case_map)
@@ -798,15 +781,16 @@ def _is_valid_default_value(self, location, generated_attribute, generated_attri
798781
# is not marked as a derived_default.
799782
#
800783
if match and model_value is not None and not is_derived_default:
801-
attr_type = type(generated_default)
802-
if CMO_TYPE in generated_attribute_info and \
803-
(generated_attribute_info[CMO_TYPE] == alias_constants.BOOLEAN or
804-
generated_attribute_info[CMO_TYPE] == alias_constants.JAVA_LANG_BOOLEAN) and \
805-
generated_default is not None and (attr_type in [str, unicode, int]):
806-
generated_default = Boolean(generated_default)
807-
message = 'Attribute=%s : Alias=%s' % (str(generated_default), str(model_default_value))
808-
self._add_error(location, ERROR_ATTRIBUTE_WRONG_DEFAULT_VALUE,
809-
message=message, attribute=generated_attribute)
784+
if not verify_utils.is_attribute_value_test_anomaly(self._model_context, location, model_name, model_value):
785+
attr_type = type(generated_default)
786+
if CMO_TYPE in generated_attribute_info and \
787+
(generated_attribute_info[CMO_TYPE] == alias_constants.BOOLEAN or
788+
generated_attribute_info[CMO_TYPE] == alias_constants.JAVA_LANG_BOOLEAN) and \
789+
generated_default is not None and (attr_type in [str, unicode, int]):
790+
generated_default = Boolean(generated_default)
791+
message = 'Attribute=%s : Alias=%s' % (str(generated_default), str(model_default_value))
792+
self._add_error(location, ERROR_ATTRIBUTE_WRONG_DEFAULT_VALUE,
793+
message=message, attribute=generated_attribute)
810794

811795
_logger.exiting(result=verify_utils.bool_to_string(match), class_name=CLASS_NAME, method_name=_method_name)
812796
return match, model_name, model_value
@@ -1498,13 +1482,6 @@ def _get_dict_key_from_value(alias_name_map, lower_case_value):
14981482
return result
14991483

15001484

1501-
def _is_in_ignore_list(location, alias_name):
1502-
path = location.get_folder_path()
1503-
if path in ALIAS_FOLDER_IGNORE_MAP and alias_name in ALIAS_FOLDER_IGNORE_MAP[path]:
1504-
return True
1505-
return False
1506-
1507-
15081485
class VerifierResult(object):
15091486
CLASS_NAME = 'VerifierResult'
15101487

0 commit comments

Comments
 (0)