Skip to content

Commit 331ef80

Browse files
authored
Wdt 575 - compareModel needs to return all original unchanged attributes for app/lib (#962)
* return all original attributes in case the diff is in a subset of attributes in app/lib
1 parent ef0d685 commit 331ef80

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

core/src/main/python/wlsdeploy/tool/compare/model_comparer.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
from wlsdeploy.aliases.model_constants import APPLICATION
1515
from wlsdeploy.aliases.model_constants import KUBERNETES
1616
from wlsdeploy.aliases.model_constants import LIBRARY
17-
from wlsdeploy.aliases.model_constants import SOURCE_PATH
18-
from wlsdeploy.exception import exception_helper
1917
from wlsdeploy.json.json_translator import COMMENT_MATCH
2018
from wlsdeploy.logging.platform_logger import PlatformLogger
2119
from wlsdeploy.util import dictionary_utils
@@ -430,14 +428,14 @@ def _finalize_folder(self, current_folder, past_folder, change_folder, location)
430428

431429
# Application and Library should include SourcePath if they have any other elements
432430
if (len(folder_path) == 1) and (folder_path[0] in self.SOURCE_PATH_FOLDERS):
433-
if change_folder and (SOURCE_PATH not in change_folder):
434-
# if SourcePath not present, past and current folder had matching values
435-
source_path = dictionary_utils.get_element(current_folder, SOURCE_PATH)
436-
if source_path is not None:
437-
comment = exception_helper.get_message('WLSDPLY-05714', SOURCE_PATH)
438-
_add_comment(comment, change_folder)
439-
change_folder[SOURCE_PATH] = source_path
440-
431+
# Handling Application and Library changes but keep the original that has not been changed
432+
if change_folder:
433+
orig_keys = dictionary_utils.get_dictionary_attributes(past_folder)
434+
for key in orig_keys:
435+
if key not in change_folder.keys():
436+
key_value = dictionary_utils.get_element(past_folder, key)
437+
if key_value is not None:
438+
change_folder[key] = key_value
441439

442440
def _add_comment(comment, dictionary):
443441
"""

core/src/test/python/compare_model_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def testCompareModelFull(self):
109109
self.assertEqual(model_dictionary['resources'].has_key('SingletonService'), True)
110110
self.assertEqual(model_dictionary['appDeployments']['Library'].has_key('!jax-rs#[email protected]'), True)
111111
self.assertEqual(model_dictionary['appDeployments']['Library'].has_key('!jsf#[email protected]'), True)
112-
self.assertEqual(model_dictionary['appDeployments']['Application']['myear'].has_key('ModuleType'), False)
112+
self.assertEqual(model_dictionary['appDeployments']['Application']['myear'].has_key('ModuleType'), True)
113113

114114
except (CompareException, PyWLSTException), te:
115115
return_code = 2

0 commit comments

Comments
 (0)