Skip to content

Commit e916d91

Browse files
authored
Add model comments for discover; remove DomainVersion attribute (#1383)
* Add comments with version and domain information to the model * Revised unit test with a different read-only attribute * Adjust system test to not expect DomainVersion
1 parent efcfbc1 commit e916d91

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

core/src/main/python/discover.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from oracle.weblogic.deploy.util import PyOrderedDict
1818
from oracle.weblogic.deploy.util import PyWLSTException
1919
from oracle.weblogic.deploy.util import TranslateException
20+
from oracle.weblogic.deploy.util import WebLogicDeployToolingVersion
2021
from oracle.weblogic.deploy.util import WLSDeployArchive
2122
from oracle.weblogic.deploy.util import WLSDeployArchiveIOException
2223
from oracle.weblogic.deploy.validate import ValidateException
@@ -26,6 +27,7 @@
2627
from wlsdeploy.aliases import model_constants
2728
from wlsdeploy.aliases.aliases import Aliases
2829
from wlsdeploy.aliases.location_context import LocationContext
30+
from wlsdeploy.aliases.model_constants import DOMAIN_INFO
2931
from wlsdeploy.aliases.wlst_modes import WlstModes
3032
from wlsdeploy.exception import exception_helper
3133
from wlsdeploy.exception.expection_types import ExceptionType
@@ -464,9 +466,18 @@ def __persist_model(model, model_context):
464466

465467
__logger.entering(class_name=_class_name, method_name=_method_name)
466468

469+
# add model comments to dictionary extracted from the Model object
470+
model_dict = model.get_model()
471+
message_1 = exception_helper.get_message('WLSDPLY-06039', WebLogicDeployToolingVersion.getVersion(), _program_name)
472+
model_dict.addComment(DOMAIN_INFO, message_1)
473+
message_2 = exception_helper.get_message('WLSDPLY-06040', WlstModes.values()[__wlst_mode],
474+
model_context.get_target_wls_version())
475+
model_dict.addComment(DOMAIN_INFO, message_2)
476+
model_dict.addComment(DOMAIN_INFO, '')
477+
467478
model_file_name = model_context.get_model_file()
468479
model_file = FileUtils.getCanonicalFile(File(model_file_name))
469-
model_translator.PythonToFile(model.get_model()).write_to_file(model_file.getAbsolutePath())
480+
model_translator.PythonToFile(model_dict).write_to_file(model_file.getAbsolutePath())
470481

471482
__logger.exiting(class_name=_class_name, method_name=_method_name)
472483

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"DbPassiveMode": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "${Db:DB}PassiveMode", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } ],
2727
"DbPassiveModeGracePeriodSeconds": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "${Db:DB}PassiveModeGracePeriodSeconds", "wlst_path": "WP001", "default_value": 30, "wlst_type": "integer" } ],
2828
"DiagnosticContextCompatibilityModeEnabled": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "DiagnosticContextCompatibilityModeEnabled", "wlst_path": "WP001", "default_value": "true", "wlst_type": "boolean" } ],
29-
"DomainVersion": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DomainVersion", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "RO"} ],
29+
"DomainVersion": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DomainVersion", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "IGNORED"} ],
3030
"EnableEeCompliantClassloadingForEmbeddedAdapters": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "Enable${Ee:EE}CompliantClassloadingForEmbeddedAdapters", "wlst_path": "WP001", "default_value": "${false:true}", "wlst_type": "boolean", "get_method": "LSA" } ],
3131
"ExalogicOptimizationsEnabled": [ {"version": "[10.3.4,)", "wlst_mode": "both", "wlst_name": "ExalogicOptimizationsEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean", "restart_required": "true" } ],
3232
"GuardianEnabled": [ {"version": "[10,12.2.1.3)", "wlst_mode": "both", "wlst_name": "GuardianEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } ,

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ WLSDPLY-06035=Unable to write the results file specified by environment variable
630630
WLSDPLY-06036=Unable to determine if production mode is enabled for the domain: {0}
631631
WLSDPLY-06037=Target directory for model file argument {0} does not exist
632632
WLSDPLY-06038=Unable to determine if secure mode is enabled for the domain: {0}
633+
WLSDPLY-06039=This model was created using the WebLogic Deploy Tooling {0} {1} tool
634+
WLSDPLY-06040=running in {0} mode against a domain using WebLogic Server {1}.
633635

634636
# discoverer.py
635637
WLSDPLY-06100=Find attributes at location {0}

core/src/test/python/aliases_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2022, Oracle and/or its affiliates.
2+
Copyright (c) 2017, 2023, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
from org.python.modules import jarray
@@ -1347,13 +1347,13 @@ def testJTAMigratableConstrainedCandidateServer(self):
13471347
self.assertEquals(wlst_value_expected, wlst_value)
13481348

13491349
def testReadOnlyDiscoverAttribute(self):
1350-
location = LocationContext()
1351-
location.add_name_token(self.online_aliases.get_name_token(location), 'my-domain')
1350+
location = LocationContext().append_location(FOLDERS.APPLICATION)
1351+
location.add_name_token(self.online_aliases.get_name_token(location), 'my-app')
13521352
model_attribute, model_value = \
1353-
self.online_aliases.get_model_attribute_name_and_value(location, FOLDERS.DOMAIN_VERSION, '12.2.1.3.0')
1354-
self.assertEquals('12.2.1.3.0', model_value)
1353+
self.online_aliases.get_model_attribute_name_and_value(location, FOLDERS.STAGE_MODE, 'mymode')
1354+
self.assertEquals('mymode', model_value)
13551355
wlst_attribute, wlst_value = \
1356-
self.online_aliases.get_wlst_attribute_name_and_value(location, FOLDERS.DOMAIN_VERSION, '12.2.1.3.0')
1356+
self.online_aliases.get_wlst_attribute_name_and_value(location, FOLDERS.STAGE_MODE, 'mymode')
13571357
self.assertEquals(None, wlst_value)
13581358

13591359
def testFolderOrder(self):

integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,6 @@ private void verifyDiscoveredJDBCWalletModelFile(String expectedModelFile) throw
12191219
checkContents.add("topology:");
12201220
checkContents.add(" Name: domain2");
12211221
checkContents.add(" AdminServerName: admin-server");
1222-
checkContents.add(" DomainVersion: 12.2.1.3.0");
12231222
checkContents.add(" ProductionModeEnabled: true");
12241223
checkContents.add(" NMProperties:");
12251224
checkContents.add(" JavaHome: /usr/java/jdk1.8.0_361");

0 commit comments

Comments
 (0)