Skip to content

Commit c836d95

Browse files
authored
Merge pull request #109 from oracle/Fix-compatibility-data-typing-for-Python-long
Updated WLST data type compatibility check method to see "class java.…
2 parents 1b5729e + bb45bce commit c836d95

File tree

5 files changed

+523
-7
lines changed

5 files changed

+523
-7
lines changed

core/src/main/python/wlsdeploy/tool/validate/validator.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
import os
6+
import copy
67

78
from oracle.weblogic.deploy.util import WLSDeployArchive
89
from oracle.weblogic.deploy.util import VariableException
@@ -108,9 +109,15 @@ def validate_in_standalone_mode(self, model_dict, variables_file_name=None, arch
108109
"""
109110
_method_name = 'validate_in_standalone_mode'
110111

112+
# We need to make a deep copy of model_dict here, to ensure it's
113+
# treated as a "read-only'" reference variable, during the variable
114+
# file validation process. The variable file validation process could
115+
# actually require changes to be made to the cloned model dictionary
116+
cloned_model_dict = copy.deepcopy(model_dict)
117+
111118
self._logger.entering(variables_file_name, archive_file_name, class_name=_class_name, method_name=_method_name)
112119
self._validation_mode = _ValidationModes.STANDALONE
113-
self.__validate_model_file(model_dict, variables_file_name, archive_file_name)
120+
self.__validate_model_file(cloned_model_dict, variables_file_name, archive_file_name)
114121

115122
self._logger.exiting(class_name=_class_name, method_name=_method_name)
116123
return self._validation_results
@@ -137,10 +144,16 @@ def validate_in_tool_mode(self, model_dict, variables_file_name=None, archive_fi
137144
"""
138145
_method_name = 'validate_in_tool_mode'
139146

147+
# We need to make a deep copy of model_dict here, to ensure it's
148+
# treated as a "read-only'" reference variable, during the variable
149+
# file validation process. The variable file validation process could
150+
# actually require changes to be made to the cloned model dictionary
151+
cloned_model_dict = copy.deepcopy(model_dict)
152+
140153
self._logger.entering(variables_file_name, archive_file_name, class_name=_class_name, method_name=_method_name)
141154
return_code = Validator.ReturnCode.STOP
142155
self._validation_mode = _ValidationModes.TOOL
143-
self.__validate_model_file(model_dict, variables_file_name, archive_file_name)
156+
self.__validate_model_file(cloned_model_dict, variables_file_name, archive_file_name)
144157

145158
status = Validator.ValidationStatus.VALID
146159

@@ -212,8 +225,7 @@ def __validate_model_file(self, model_dict, variables_file_name, archive_file_na
212225
if variables_file_name is not None:
213226
self._logger.info('WLSDPLY-05004', variables_file_name, class_name=_class_name, method_name=_method_name)
214227
try:
215-
if self._model_context.get_variable_file():
216-
self._variable_properties = variables.load_variables(self._model_context.get_variable_file())
228+
self._variable_properties = variables.load_variables(variables_file_name)
217229
variables.substitute(model_dict, self._variable_properties)
218230
except VariableException, ve:
219231
ex = exception_helper.create_validate_exception('WLSDPLY-20004', 'validateModel',

core/src/test/python/validation_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ def setUp(self):
3535
self.wls_helper = WebLogicHelper(self._logger)
3636

3737
def testModelValidation(self):
38-
39-
_model_file = self._resources_dir + '/test_jms_mail.json'
4038
_method_name = 'testModelValidation'
4139

40+
_model_file = self._resources_dir + '/variablestest.yaml'
41+
_variable_file = self._resources_dir + '/variablestest.properties'
42+
_archive_file = self._resources_dir + '/variablestest.zip'
43+
4244
mw_home = os.environ['MW_HOME']
4345
args_map = {
4446
'-oracle_home': mw_home,
45-
'-model_file': _model_file
47+
'-model_file': _model_file,
48+
'-variable_file': _variable_file,
49+
'-archive_file': _archive_file
4650
}
4751

4852
model_context = ModelContext('ValidationTestCase', args_map)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SecurityConfiguration.CredentialEncrypted=welcome1
2+
SecurityConfiguration.NodeManagerUsername=weblogic
3+
SecurityConfiguration.NodeManagerPasswordEncrypted=welcome1
4+
JDBCSystemResource.MyPersistentStoreDS.JdbcResource.JDBCDriverParams.PasswordEncrypted=welcome1
5+
JDBCSystemResource.MyPersistentStoreDS.JdbcResource.JDBCDriverParams.Properties.user.Value=weblogic
6+
JDBCSystemResource.MyDataSource.JdbcResource.JDBCDriverParams.PasswordEncrypted=welcome1
7+
JDBCSystemResource.MyDataSource.JdbcResource.JDBCDriverParams.Properties.user.Value=weblogic
8+
MailSession.MyMailSession.SessionPasswordEncrypted=welcome1
9+
MailSession.MyMailSession.SessionUsername=weblogic
10+
MailSession.MailSession-0.SessionPasswordEncrypted=welcome1
11+
MailSession.MailSession-0.SessionUsername=weblogic
12+
JMSSystemResource.MyJmsModule.JmsResource.ForeignServer.MyForeignServer.JNDIPropertiesCredentialEncrypted=welcome1
13+
JMSSystemResource.MyJmsModule.JmsResource.SAFRemoteContext.MyRemoteSAFcontext.SAFLoginContext.PasswordEncrypted=welcome1
14+
JMSSystemResource.MyJmsModule.JmsResource.SAFRemoteContext.MyRemoteSAFcontext.SAFLoginContext.Username=weblogic
15+
JMSBridgeDestination.JMS-Bridge-Remote-Destination.UserName=weblogic
16+
JMSBridgeDestination.JMS-Bridge-Remote-Destination.UserPasswordEncrypted=welcome1
17+
WLDFSystemResource.MyWldfModule.WLDFResource.WatchNotification.RestNotification.MyRestAction.HttpAuthenticationPasswordEncrypted=welcome1
18+
WLDFSystemResource.MyWldfModule.WLDFResource.WatchNotification.RestNotification.MyRestAction.HttpAuthenticationUserName=weblogic

0 commit comments

Comments
 (0)