Skip to content

Commit 7c2a4ec

Browse files
reordering JDBCStore creation so that it succeeds (#1247)
1 parent 2e251cd commit 7c2a4ec

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __folder_hierarchy(self, mbean_dictionary, online_dictionary, mbean_path, pa
9292
mbean_dictionary[ATTRIBUTES] = self.__get_attributes(mbean_instance)
9393

9494
info_helper = MBeanInfoHelper(mbean_instance, mbean_path)
95-
info_map = info_helper.get_child_mbeans()
95+
info_map = generator_utils.reorder_info_map(mbean_path, info_helper.get_child_mbeans())
9696

9797
methods_helper = MBeanMethodHelper(mbean_instance, mbean_path)
9898
methods_map = methods_helper.get_child_mbeans()

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
@@ -110,7 +110,7 @@ def get(attribute_name):
110110
get_value = local_get(attribute_name)
111111
except (online_wlst_exception, offlineWLSTException), we:
112112
success = False
113-
__logger.warning('Unable to get attribute{0} at location {1} : {2}', attribute_name, current_path(),
113+
__logger.warning('Unable to get attribute {0} at location {1} : {2}', attribute_name, current_path(),
114114
we.getLocalizedMessage(), class_name=__class_name, method_name=_method_name)
115115

116116
return success, get_value

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,27 @@
5858

5959
OUTPUT_DIR_SWITCH = '-output_dir'
6060

61+
# In offline mode, we cannot create a JDBC Store if the domain doesn't
62+
# have a JDBCSystemResource (or other JDBCStore) so we need to make sure
63+
# to reorder the dictionary so that JDBCStores comes after
64+
# JDBCSystemResources.
65+
#
66+
TOP_LEVEL_INFO_MAP_DEPENDENCIES = {
67+
'JDBCStores': 'JDBCSystemResources'
68+
}
69+
70+
6171
__logger = PlatformLogger('test.aliases')
6272
__logger.set_level(Level.FINER)
6373
CLASS_NAME = 'generate/utils'
6474

6575

76+
def reorder_info_map(mbean_path, info_map):
77+
if mbean_path == '/':
78+
return _reorder_top_level_info_map(info_map)
79+
return info_map
80+
81+
6682
def get_generate_args_map(args):
6783
"""
6884
The provided arguments are the command line key, value pairs.
@@ -306,6 +322,27 @@ def get_mbean_methods(mbean_instance):
306322
return list()
307323

308324

325+
def _reorder_top_level_info_map(info_map):
326+
keys = info_map.keys()
327+
328+
new_keys = list()
329+
delayed_keys = list()
330+
for key in keys:
331+
if key in TOP_LEVEL_INFO_MAP_DEPENDENCIES and TOP_LEVEL_INFO_MAP_DEPENDENCIES[key] not in new_keys:
332+
delayed_keys.append(key)
333+
else:
334+
new_keys.append(key)
335+
336+
if len(delayed_keys) > 0:
337+
new_info_map = PyOrderedDict()
338+
for key in new_keys:
339+
new_info_map[key] = info_map[key]
340+
for key in delayed_keys:
341+
new_info_map[key] = info_map[key]
342+
return new_info_map
343+
return info_map
344+
345+
309346
class GenerateModelContext(ModelContext):
310347
def __init__(self, program_name, arg_map):
311348
super(GenerateModelContext, self).__init__(program_name, arg_map)

0 commit comments

Comments
 (0)