4848from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
4949from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
5050from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_USER_PROPERTY
51+ from wlsdeploy .aliases .model_constants import JDBC_DATASOURCE_PARAMS
52+ from wlsdeploy .aliases .model_constants import JDBC_DATASOURCE_PARAMS_DATASOURCE_LIST
5153from wlsdeploy .aliases .model_constants import JDBC_DRIVER_PARAMS
5254from wlsdeploy .aliases .model_constants import JDBC_DRIVER_PARAMS_PROPERTIES
5355from wlsdeploy .aliases .model_constants import JDBC_RESOURCE
@@ -105,19 +107,24 @@ def __init__(self, model_object, archive_helper, model_context, aliases, excepti
105107 ####################
106108
107109 def check_or_run_rcu (self ):
110+
111+ _method_name = 'check_or_run_rcu'
112+
108113 # This squelches the following error during JRF domain creation with an ATP database.
109114 #
110115 # ####<Mar 29, 2024 3:19:53 PM> <SEVERE> <FanManager> <configure> <> <attempt to configure
111116 # ONS in FanManager failed with oracle.ons.NoServersAvailable: Subscription time out>
112117 #
118+
113119 if self ._rcu_db_info .is_use_atp ():
114120 System .setProperty ('oracle.jdbc.fanEnabled' , 'false' )
115121
116122 if self ._model_context .get_domain_typedef ().requires_rcu ():
117123 if self ._model_context .is_run_rcu ():
118124 self .__run_rcu ()
119125 else :
120- self .__precheck_rcu_connectivity ()
126+ if not self ._rcu_db_info .is_rcu_db_info_empty ():
127+ self .__precheck_rcu_connectivity ()
121128
122129 def configure_fmw_infra_database (self ):
123130 """
@@ -128,7 +135,6 @@ def configure_fmw_infra_database(self):
128135 _method_name = 'configure_fmw_infra_database'
129136 self .__logger .entering (class_name = self .__class_name , method_name = _method_name )
130137
131- # only continue with RCU configuration for domain type that requires RCU.
132138 if not self ._domain_typedef .requires_rcu ():
133139 self .__logger .finer ('WLSDPLY-12249' , class_name = self .__class_name , method_name = _method_name )
134140 return
@@ -237,15 +243,77 @@ def fix_jps_config(self):
237243 # PRIVATE METHODS
238244 ####################
239245
246+ def __precheck_rcu_default_datasource_entries_for_norcu (self , default_ds_names ):
247+ _method_name = '__precheck_rcu_default_datasource_entries_for_norcu'
248+
249+ resources_dict = self ._model_object .get_model_resources ()
250+
251+ not_found_ds_names = []
252+ if JDBC_SYSTEM_RESOURCE in resources_dict :
253+ ds_dict = resources_dict [JDBC_SYSTEM_RESOURCE ]
254+
255+ if len (ds_dict ) == 0 :
256+ not_found_ds_names = default_ds_names
257+ else :
258+ for ds_name in default_ds_names :
259+ if ds_name not in ds_dict .keys ():
260+ not_found_ds_names .append (ds_name )
261+ else :
262+ not_found_ds_names = default_ds_names
263+
264+ if len (not_found_ds_names ) > 0 :
265+ ex = exception_helper .create_create_exception ('WLSDPLY-12285' , not_found_ds_names )
266+ self .__logger .throwing (ex , class_name = self .__class_name , method_name = _method_name )
267+ raise ex
268+
269+ # Try best effort to test connectivity
270+ for ds_name in ds_dict .keys ():
271+ try :
272+ datasource = ds_dict [ds_name ]
273+ ds_resource = dictionary_utils .get_element (datasource , JDBC_RESOURCE )
274+ if ds_resource is None :
275+ continue
276+ datasource_param = dictionary_utils .get_element (ds_resource , JDBC_DATASOURCE_PARAMS , None )
277+ if datasource_param :
278+ source_list = dictionary_utils .get_element (datasource_param ,
279+ JDBC_DATASOURCE_PARAMS_DATASOURCE_LIST , None )
280+ if source_list is not None :
281+ # skip test for multi datasource
282+ continue
283+
284+ driver_param = dictionary_utils .get_element (ds_resource , JDBC_DRIVER_PARAMS )
285+ if driver_param :
286+ jdbc_conn_string = dictionary_utils .get_element (driver_param , URL , None )
287+ model_ds_props = dictionary_utils .get_element (driver_param , JDBC_DRIVER_PARAMS_PROPERTIES , None )
288+ jdbc_driver_name = dictionary_utils .get_element (driver_param , DRIVER_NAME , None )
289+ conn_password = dictionary_utils .get_element (driver_param , PASSWORD_ENCRYPTED , None )
290+ props = Properties ()
291+ if model_ds_props is not None :
292+ for item in model_ds_props .keys ():
293+ props .put (item , model_ds_props [item ]['Value' ])
294+ if conn_password :
295+ props .put ('password' , conn_password )
296+ # skip test if they are none and let it fail during create with default value from the template
297+ if jdbc_driver_name and jdbc_conn_string and conn_password :
298+ self .__logger .fine ("WLSDPLY-12288" , ds_name )
299+ JClass .forName (jdbc_driver_name )
300+ DriverManager .getConnection (jdbc_conn_string , props )
301+ except JException , e :
302+ ex = exception_helper .create_create_exception ("WLSDPLY-12286" , ds_name ,
303+ e .getLocalizedMessage (), error = e )
304+ self .__logger .throwing (ex , class_name = self .__class_name , method_name = _method_name )
305+ raise ex
306+
307+
240308 def __precheck_rcu_connectivity (self ):
241309 _method_name = 'precheck_rcu_connectivity'
242310 self .__logger .entering (class_name = self .__class_name , method_name = _method_name )
243311
244312 domain_typename = self ._model_context .get_domain_typedef ().get_domain_type ()
245313
246- rcu_prefix = self ._rcu_db_info .get_rcu_prefix ()
247314 schema_name = None
248315 user_name = None
316+ rcu_prefix = self ._rcu_db_info .get_rcu_prefix ()
249317 if not string_utils .is_empty (rcu_prefix ):
250318 user_name = self ._model_context .get_weblogic_helper ().get_stb_user_name (rcu_prefix )
251319 schema_name = user_name [len (rcu_prefix ) + 1 :]
@@ -324,6 +392,8 @@ def __run_rcu(self):
324392 self .__logger .exiting (class_name = self .__class_name , method_name = _method_name )
325393 return
326394
395+ self .__logger .info ("WLSDPLY-12287" , class_name = self .__class_name , method_name = _method_name )
396+
327397 rcu_db_info = self ._rcu_db_info
328398 oracle_home = self ._model_context .get_oracle_home ()
329399 java_home = self ._model_context .get_java_home ()
@@ -585,17 +655,23 @@ def __set_rcu_datasource_parameters_without_shadow_table(self):
585655 _method_name = '__set_rcu_datasource_parameters_without_shadow_table'
586656 self .__logger .entering (class_name = self .__class_name , method_name = _method_name )
587657
588- tns_admin , rcu_prefix , data_source_conn_string , rcu_schema_pwd = \
589- self .__get_rcu_datasource_basic_connection_info ()
590- keystore , keystore_type , keystore_pwd , truststore , truststore_type , truststore_pwd = \
591- self .__get_rcu_datasource_ssl_connection_info ()
592-
593658 location = LocationContext ()
594659 location .append_location (JDBC_SYSTEM_RESOURCE )
595660 folder_path = self ._aliases .get_wlst_list_path (location )
596661 self ._wlst_helper .cd (folder_path )
597662 ds_names = self ._wlst_helper .lsc ()
598663
664+ if self ._rcu_db_info .is_rcu_db_info_empty ():
665+ self .__logger .fine ("WLSDPLY-12284" , class_name = self .__class_name , method_name = _method_name )
666+ self .__precheck_rcu_default_datasource_entries_for_norcu (ds_names )
667+ return ds_names
668+
669+ tns_admin , rcu_prefix , data_source_conn_string , rcu_schema_pwd = \
670+ self .__get_rcu_datasource_basic_connection_info ()
671+ keystore , keystore_type , keystore_pwd , truststore , truststore_type , truststore_pwd = \
672+ self .__get_rcu_datasource_ssl_connection_info ()
673+
674+
599675 rcu_database_type = self ._rcu_db_info .get_rcu_database_type ()
600676 jdbc_driver_class_name = self .__get_jdbc_driver_class_name (rcu_database_type )
601677
0 commit comments