Skip to content

Commit 6564e3d

Browse files
committed
Merge branch 'wls14-unit-tests' into 'main'
Fixing unit tests to run with Jython 2.7 and cleaning up RCUDbInfo section parameters See merge request weblogic-cloud/weblogic-deploy-tooling!1519
2 parents 02943c0 + ca2d6b7 commit 6564e3d

File tree

6 files changed

+67
-60
lines changed

6 files changed

+67
-60
lines changed

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,9 @@
2323
APP_DIR = 'AppDir'
2424
APPEND = 'append'
2525
APPLICATION = 'Application'
26-
RCU_DB_INFO = 'RCUDbInfo'
27-
OPSS_SECRETS = 'OPSSSecrets'
28-
RCU_PREFIX = 'rcu_prefix'
29-
RCU_SCHEMA_PASSWORD = 'rcu_schema_password'
30-
RCU_ADMIN_PASSWORD = 'rcu_admin_password'
31-
RCU_DEFAULT_TBLSPACE = 'rcu_default_tablespace'
32-
RCU_TEMP_TBLSPACE = 'rcu_temp_tablespace'
33-
RCU_DB_USER = 'rcu_db_user'
34-
RCU_DB_CONN = 'rcu_db_conn_string'
35-
RCU_COMP_INFO = 'compInfoXMLLocation'
36-
RCU_STG_INFO = 'storageXMLLocation'
37-
RCU_VARIABLES = 'rcu_variables'
38-
DATABASE_TYPE = 'databaseType'
39-
USE_ATP = 'useATP'
40-
TNS_ENTRY = 'tns.alias'
4126
ATP_DEFAULT_TABLESPACE = 'atp.default.tablespace'
4227
ATP_TEMPORARY_TABLESPACE = 'atp.temp.tablespace'
43-
ATP_ADMIN_USER = 'atp.admin.user'
28+
ATP_ADMIN_USER = 'atp.admin.user' # deprecated
4429
AUDITOR = 'Auditor'
4530
AUTHENTICATION_PROVIDER = 'AuthenticationProvider'
4631
AUTHORIZER = 'Authorizer'
@@ -88,6 +73,7 @@
8873
CROSS_DOMAIN = 'CrossDomain'
8974
CUSTOM_DBMS_AUTHENTICATOR = 'CustomDBMSAuthenticator'
9075
DATA_SOURCE = 'DataSource'
76+
DATABASE_TYPE = 'databaseType'
9177
DEFAULT_ADJUDICATOR = 'DefaultAdjudicator'
9278
DEFAULT_ADMIN_SERVER_NAME = 'AdminServer'
9379
DEFAULT_AUDITOR = 'DefaultAuditor'
@@ -211,6 +197,7 @@
211197
OHS = 'OHS'
212198
OPEN_LDAP_AUTHENTICATOR = 'OpenLDAPAuthenticator'
213199
OPSS_INITIALIZATION = 'OPSSInitialization'
200+
OPSS_SECRETS = 'OPSSSecrets'
214201
ORACLE_OID_AUTHENTICATOR = 'OracleInternetDirectoryAuthenticator'
215202
ORACLE_OUD_AUTHENTICATOR = 'OracleUnifiedDirectoryAuthenticator'
216203
ORACLE_OVD_AUTHENTICATOR = 'OracleVirtualDirectoryAuthenticator'
@@ -235,6 +222,18 @@
235222
QUOTA = 'Quota'
236223
REALM = 'Realm'
237224
RECOVER_ONLY_ONCE = 'RecoverOnlyOnce'
225+
RCU_ADMIN_PASSWORD = 'rcu_admin_password'
226+
RCU_ADMIN_USER = 'rcu_admin_user'
227+
RCU_COMP_INFO = 'compInfoXMLLocation'
228+
RCU_DB_CONN = 'rcu_db_conn_string'
229+
RCU_DB_INFO = 'RCUDbInfo'
230+
RCU_DB_USER = 'rcu_db_user' # deprecated
231+
RCU_DEFAULT_TBLSPACE = 'rcu_default_tablespace'
232+
RCU_PREFIX = 'rcu_prefix'
233+
RCU_SCHEMA_PASSWORD = 'rcu_schema_password'
234+
RCU_STG_INFO = 'storageXMLLocation'
235+
RCU_TEMP_TBLSPACE = 'rcu_temp_tablespace'
236+
RCU_VARIABLES = 'rcu_variables'
238237
REMOTE_DOMAIN = 'RemoteDomain'
239238
REMOTE_HOST = 'RemoteHost'
240239
REMOTE_PASSWORD = 'RemotePassword'
@@ -303,6 +302,7 @@
303302
TEMPLATE = 'Template'
304303
THREAD_DUMP_ACTION = 'ThreadDumpAction'
305304
THRESHOLDS = 'Thresholds'
305+
TNS_ENTRY = 'tns.alias'
306306
TOPIC = 'Topic'
307307
TOPOLOGY = 'topology'
308308
TRANSACTION_LOG_JDBC_STORE = 'TransactionLogJDBCStore'
@@ -313,6 +313,7 @@
313313
UNIX_MACHINE = 'UnixMachine'
314314
UNIX_MACHINE_ATTRIBUTE = 'PostBindGID'
315315
UPDATE_MODE = 'UpdateMode'
316+
USE_ATP = 'useATP'
316317
USER = 'User'
317318
USER_ATTRIBUTES = 'UserAttribute'
318319
USE_SAMPLE_DATABASE = 'UseSampleDatabase'

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,25 +326,22 @@ def __run_rcu(self):
326326

327327
# reset these to pick up any defaults from rcu_db_info
328328

329-
rcu_runner_map[ATP_ADMIN_USER] = rcu_db_info.get_atp_admin_user()
329+
rcu_runner_map[ATP_ADMIN_USER] = rcu_db_info.get_rcu_admin_user()
330330
rcu_runner_map[ATP_TEMPORARY_TABLESPACE] = rcu_db_info.get_atp_temporary_tablespace()
331331
rcu_runner_map[ATP_DEFAULT_TABLESPACE] = rcu_db_info.get_atp_default_tablespace()
332332

333333
fmw_database = self.wls_helper.get_jdbc_url_from_rcu_connect_string(rcu_database)
334334
runner = RCURunner.createAtpRunner(domain_type, oracle_home, java_home, fmw_database,
335-
rcu_schemas, rcu_prefix,
336-
rcu_db_info.get_rcu_variables(), rcu_db_info.get_database_type(),
337-
rcu_runner_map,
338-
ssl_conn_properties
339-
)
335+
rcu_schemas, rcu_prefix, rcu_db_info.get_rcu_variables(),
336+
rcu_db_info.get_database_type(), rcu_runner_map, ssl_conn_properties)
340337

341338
elif rcu_db_info.is_use_ssl():
342339

343340
tns_admin, rcu_database, truststore_pwd, truststore_type, \
344341
truststore, keystore_pwd, keystore_type, keystore = self.__validate_and_get_ssl_rcudbinfo(rcu_db_info)
345342

346343
rcu_runner_map = dict()
347-
rcu_db_user = rcu_db_info.get_rcu_db_user()
344+
rcu_admin_user = rcu_db_info.get_rcu_admin_user()
348345
ssl_conn_properties = dict()
349346

350347
self._set_rcu_ssl_args_properties(ssl_conn_properties, rcu_db_info, keystore, keystore_type, truststore,
@@ -356,7 +353,7 @@ def __run_rcu(self):
356353
runner = RCURunner.createSslRunner(domain_type, oracle_home, java_home, fmw_database, rcu_prefix, rcu_schemas,
357354
rcu_db_info.get_rcu_variables(), rcu_runner_map, ssl_conn_properties)
358355

359-
runner.setRCUAdminUser(rcu_db_user)
356+
runner.setRCUAdminUser(rcu_admin_user)
360357
else:
361358
# Non-ATP database, use DB config from the command line or RCUDbInfo in the model.
362359
rcu_db = rcu_db_info.get_rcu_regular_db_conn()
@@ -365,11 +362,11 @@ def __run_rcu(self):
365362
ex = exception_helper.create_create_exception('WLSDPLY-12572')
366363
raise ex
367364

368-
rcu_db_user = rcu_db_info.get_rcu_db_user()
365+
rcu_admin_user = rcu_db_info.get_rcu_admin_user()
369366

370367
runner = RCURunner.createRunner(domain_type, oracle_home, java_home, rcu_db, rcu_prefix, rcu_schemas,
371368
rcu_db_info.get_rcu_variables())
372-
runner.setRCUAdminUser(rcu_db_user)
369+
runner.setRCUAdminUser(rcu_admin_user)
373370

374371
rcu_comp_info_location = self.__extract_rcu_xml_file(RCU_COMP_INFO, rcu_db_info.get_comp_info_location())
375372
rcu_storage_location = self.__extract_rcu_xml_file(RCU_STG_INFO, rcu_db_info.get_storage_location())

core/src/main/python/wlsdeploy/tool/create/rcudbinfo_helper.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
1717
from wlsdeploy.aliases.model_constants import DRIVER_PARAMS_KEYSTORE_PROPERTY
1818
from wlsdeploy.aliases.model_constants import RCU_ADMIN_PASSWORD
19+
from wlsdeploy.aliases.model_constants import RCU_ADMIN_USER
1920
from wlsdeploy.aliases.model_constants import RCU_DB_CONN
2021
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
2122
from wlsdeploy.aliases.model_constants import RCU_DB_USER
@@ -160,28 +161,30 @@ def get_atp_temporary_tablespace(self):
160161
else:
161162
return 'TEMP'
162163

163-
def get_atp_admin_user(self):
164-
_method_name = 'get_atp_admin_user'
165-
result = self._get_dictionary_element_value(ATP_ADMIN_USER)
166-
if result is not None:
167-
self._logger.deprecation('WLSDPLY-22000', ATP_ADMIN_USER, RCU_DB_USER,
168-
class_name=_class_name, method_name=_method_name)
169-
return result
170-
elif self.get_rcu_db_user() is not None:
171-
return self.get_rcu_db_user()
172-
else:
173-
return 'admin'
174-
175-
def get_rcu_db_user(self):
176-
cli_admin_user = self.model_context.get_rcu_db_user()
177-
if cli_admin_user != ModelContext.DB_USER_DEFAULT:
164+
def get_rcu_admin_user(self):
165+
_method_name = 'get_rcu_admin_user'
166+
# Deprecated CLI arg (deprecation message is printed elsewhere)
167+
cli_admin_user = self.model_context.get_rcu_admin_user()
168+
if cli_admin_user != ModelContext.RCU_ADMIN_USER_DEFAULT:
178169
return cli_admin_user
179170

180-
result = self._get_dictionary_element_value(RCU_DB_USER)
181-
if result is not None:
182-
return result
183-
else:
184-
return cli_admin_user
171+
result = self._get_dictionary_element_value(RCU_ADMIN_USER)
172+
if result is None:
173+
result = self._get_dictionary_element_value(RCU_DB_USER)
174+
if result is not None:
175+
self._logger.deprecation('WLSDPLY-22000', RCU_DB_USER, RCU_ADMIN_USER,
176+
class_name=_class_name, method_name=_method_name)
177+
else:
178+
result = self._get_dictionary_element_value(ATP_ADMIN_USER)
179+
if result is not None:
180+
self._logger.deprecation('WLSDPLY-22000', ATP_ADMIN_USER, RCU_ADMIN_USER,
181+
class_name=_class_name, method_name=_method_name)
182+
if result is None:
183+
if self.is_use_atp():
184+
result = 'admin'
185+
else:
186+
result = ModelContext.RCU_ADMIN_USER_DEFAULT
187+
return result
185188

186189
def get_comp_info_location(self):
187190
result = self._get_dictionary_element_value(RCU_COMP_INFO)

core/src/main/python/wlsdeploy/util/model_context.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ModelContext(object):
4040
CURRENT_DIRECTORY_TOKEN = '@@PWD@@'
4141
TEMP_DIRECTORY_TOKEN = '@@TMP@@'
4242

43-
DB_USER_DEFAULT = 'SYS'
43+
RCU_ADMIN_USER_DEFAULT = 'SYS'
4444

4545
def __init__(self, program_name, arg_map=None):
4646
"""
@@ -71,6 +71,7 @@ def __init__(self, program_name, arg_map=None):
7171
self._model_file = None
7272
self._variable_file_name = None
7373
self._run_rcu = False
74+
self._rcu_admin_user = self.RCU_ADMIN_USER_DEFAULT
7475
self._rcu_database = None
7576
self._rcu_prefix = None
7677
self._rcu_sys_pass = None
@@ -97,7 +98,6 @@ def __init__(self, program_name, arg_map=None):
9798
self._variable_injector_file = None
9899
self._variable_keywords_file = None
99100
self._variable_properties_file = None
100-
self._rcu_db_user = self.DB_USER_DEFAULT
101101
self._discard_current_edit = False
102102
self._wait_for_edit_lock = False
103103
self._remote = False
@@ -198,17 +198,20 @@ def __copy_from_args(self, arg_map):
198198
if CommandLineArgUtil.RUN_RCU_SWITCH in arg_map:
199199
self._run_rcu = arg_map[CommandLineArgUtil.RUN_RCU_SWITCH]
200200

201+
# deprecated command-line arg
201202
if CommandLineArgUtil.RCU_DB_SWITCH in arg_map:
202203
self._rcu_database = arg_map[CommandLineArgUtil.RCU_DB_SWITCH]
203204

205+
# deprecated command-line arg
204206
if CommandLineArgUtil.RCU_PREFIX_SWITCH in arg_map:
205207
self._rcu_prefix = arg_map[CommandLineArgUtil.RCU_PREFIX_SWITCH]
206208

207209
if CommandLineArgUtil.RCU_SYS_PASS_SWITCH in arg_map:
208210
self._rcu_sys_pass = arg_map[CommandLineArgUtil.RCU_SYS_PASS_SWITCH]
209211

212+
# deprecated command-line arg
210213
if CommandLineArgUtil.RCU_DB_USER_SWITCH in arg_map:
211-
self._rcu_db_user = arg_map[CommandLineArgUtil.RCU_DB_USER_SWITCH]
214+
self._rcu_admin_user = arg_map[CommandLineArgUtil.RCU_DB_USER_SWITCH]
212215

213216
if CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH in arg_map:
214217
self._rcu_schema_pass = arg_map[CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH]
@@ -325,8 +328,8 @@ def __copy__(self):
325328
arg_map[CommandLineArgUtil.RCU_PREFIX_SWITCH] = self._rcu_prefix
326329
if self._rcu_sys_pass is not None:
327330
arg_map[CommandLineArgUtil.RCU_SYS_PASS_SWITCH] = self._rcu_sys_pass
328-
if self._rcu_db_user is not None:
329-
arg_map[CommandLineArgUtil.RCU_DB_USER_SWITCH] = self._rcu_db_user
331+
if self._rcu_admin_user is not None:
332+
arg_map[CommandLineArgUtil.RCU_DB_USER_SWITCH] = self._rcu_admin_user
330333
if self._rcu_schema_pass is not None:
331334
arg_map[CommandLineArgUtil.RCU_SCHEMA_PASS_SWITCH] = self._rcu_schema_pass
332335
if self._domain_typedef is not None:
@@ -631,12 +634,12 @@ def get_rcu_prefix(self):
631634
"""
632635
return self._rcu_prefix
633636

634-
def get_rcu_db_user(self):
637+
def get_rcu_admin_user(self):
635638
"""
636639
Get the RCU DB user.
637640
:return: the RCU dbUser
638641
"""
639-
return self._rcu_db_user
642+
return self._rcu_admin_user
640643

641644
def get_rcu_sys_pass(self):
642645
"""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"folders": {},
66
"attributes": {
77
"atp.admin.user": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "atp.admin.user", "wlst_path": "WP001", "default_value": null, "wlst_type": "credential" } ],
8-
"ssl.admin.user": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ssl.admin.user", "wlst_path": "WP001", "default_value": null, "wlst_type": "credential", "secret_suffix": "ssladmin" } ],
98
"atp.default.tablespace": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "atp.default.tablespace", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
109
"atp.temp.tablespace": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "atp.temp.tablespace", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
1110
"databaseType": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "databaseType", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
@@ -18,6 +17,7 @@
1817
"javax.net.ssl.trustStorePassword": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "javax.net.ssl.trustStorePassword", "wlst_path": "WP001", "default_value": null, "wlst_type": "password", "secret_suffix": "ssltruststore" } ],
1918
"oracle.net.tns_admin": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "oracle.net.tns_admin", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "uses_path_tokens": "true"} ],
2019
"rcu_admin_password": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "rcu_admin_password", "wlst_path": "WP001", "default_value": null, "wlst_type": "password" } ],
20+
"rcu_admin_user": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "rcu_admin_user", "wlst_path": "WP001", "default_value": null, "wlst_type": "credential" } ],
2121
"rcu_db_conn_string": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "rcu_db_conn_string", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
2222
"rcu_prefix": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "rcu_prefix", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
2323
"rcu_db_user": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "rcu_db_user", "wlst_path": "WP001", "default_value": null, "wlst_type": "credential" } ],

core/src/test/python/alias_file_content_test.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@
2222
from wlsdeploy.aliases.alias_constants import WLST_TYPE
2323
from wlsdeploy.aliases.alias_entries import AliasEntries
2424
from wlsdeploy.aliases.model_constants import ATP_ADMIN_USER
25+
from wlsdeploy.aliases.model_constants import RCU_DB_USER
2526
from wlsdeploy.aliases.wlst_modes import WlstModes
2627
from wlsdeploy.util import dictionary_utils
28+
from wlsdeploy.util import unicode_helper
2729

2830

2931
class AliasFileContentTestCase(unittest.TestCase):
3032
_resources_dir = '../../test-classes/'
3133
_token_pattern = re.compile("^%([\\w-]+)%$")
3234
_base_wlst_path_name = 'WP001'
33-
_credential_exceptions = [ATP_ADMIN_USER]
35+
_credential_exceptions = [ unicode_helper.to_string(ATP_ADMIN_USER), unicode_helper.to_string(RCU_DB_USER) ]
3436

3537
def setUp(self):
3638
self.alias_entries = AliasEntries(wls_version='12.2.1.3')
@@ -163,16 +165,17 @@ def _check_secret_names(self, folder_path, folder_dict):
163165
if wlst_type in suffix_maps.keys():
164166
suffix_map = suffix_maps[wlst_type]
165167
suffixed_attribute = dictionary_utils.get_element(suffix_map, secret_suffix)
166-
if suffixed_attribute and suffixed_attribute != attribute_name:
168+
if unicode_helper.to_string(attribute_name) in self._credential_exceptions:
169+
continue
170+
171+
if suffixed_attribute and unicode_helper.to_string(suffixed_attribute) != unicode_helper.to_string(attribute_name):
167172
result.append('Multiple %s attributes in path %s with secret_suffix %s: %s and %s' %
168173
(wlst_type, folder_path, secret_suffix, suffixed_attribute, attribute_name))
169-
elif attribute_name not in self._credential_exceptions:
170-
suffix_map[secret_suffix] = attribute_name
174+
else:
175+
suffix_map[secret_suffix] = unicode_helper.to_string(attribute_name)
171176
elif secret_suffix:
172177
result.append('Attribute %s in path %s with type %s should not have secret suffix' %
173178
(attribute_name, folder_path, wlst_type))
174-
175-
176179
return result
177180

178181
def _check_version_ranges(self, attribute_value, new_folder_path, attribute_name):

0 commit comments

Comments
 (0)