def convert_to_absolute_path(relative_to, file_name): """ Transform the path by joining the relative_to before the file_name and converting the resulting path name to an absolute path name. :param relative_to: prefix of the path :param file_name: name of the file :return: absolute path of the relative_to and file_name """ if not StringUtils.isEmpty(relative_to) and not StringUtils.isEmpty(file_name): file_name = os.path.join(relative_to, file_name) return file_name
def __get_log_directory(self, option_value): if StringUtils.isEmpty(option_value): log_dir = get_canonical_path(self.get_build_dir(), SystemTestSupport.LOG_DIR_DEFAULT) else: log_dir = get_canonical_file(option_value) return log_dir
def __get_and_validate_test_support_home(self, option_value): _method_name = '__get_and_validate_test_support_home' if StringUtils.isEmpty(option_value): test_support_home = get_canonical_path( self.get_build_dir(), SystemTestSupport.TEST_SUPPORT_HOME_DEFAULT) else: test_support_home = get_canonical_file(option_value) if not test_support_home.exists(): ex = exception_helper.create_system_test_exception( 'WLSDPLY-09869', 'TEST_SUPPORT_HOME', test_support_home.getPath()) _logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex elif not test_support_home.isDirectory(): ex = exception_helper.create_system_test_exception( 'WLSDPLY-09870', 'TEST_SUPPORT_HOME', test_support_home.getPath()) _logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex return test_support_home
def archive_file_store_directory(self, file_store_name, file_store_dictionary): _method_name = 'archive_file_store_directory' _logger.entering(file_store_name, class_name=_class_name, method_name=_method_name) if file_store_name is not None and model_constants.DIRECTORY in file_store_dictionary: directory = file_store_dictionary[model_constants.DIRECTORY] if not StringUtils.isEmpty(directory): archive_file = self._model_context.get_archive_file() try: new_source_name = archive_file.addFileStoreDirectory( file_store_name) except WLSDeployArchiveIOException, wioe: de = exception_helper.create_discover_exception( 'WLSDPLY-06348', file_store_name, directory, wioe.getLocalizedMessage()) _logger.throwing(class_name=_class_name, method_name=_method_name, error=de) raise de if new_source_name is not None: _logger.info('WLSDPLY-06349', file_store_name, new_source_name, class_name=_class_name, method_name=_method_name) file_store_dictionary[ model_constants.DIRECTORY] = new_source_name
def _add_classpath_libraries_to_archive(self, model_name, model_value, location): """ This is a private method. Add the server files and directories listed in the server classpath attribute to the archive file. File locations in the oracle_home will be removed from the classpath and will not be added to the archive file. :param model_name: attribute for the server server start classpath attribute :param model_value: classpath value in domain :param location: context containing current location information :return model """ _method_name = 'add_classpath_libraries_to_archive' server_name = self._get_server_name_from_location(location) _logger.entering(server_name, model_name, model_value, class_name=_class_name, method_name=_method_name) classpath_string = None if not StringUtils.isEmpty(model_value): # model values are comma-separated classpath_entries = model_value.split(MODEL_LIST_DELIMITER) if classpath_entries: classpath_list = [] for classpath_entry in classpath_entries: classpath_entry = self._model_context.replace_token_string(classpath_entry) new_source_name = self._add_library(server_name, classpath_entry) if new_source_name is not None: classpath_list.append(new_source_name) classpath_string = StringUtils.getStringFromList(classpath_list, MODEL_LIST_DELIMITER) _logger.fine('WLSDPLY-06617', server_name, classpath_string, class_name=_class_name, method_name=_method_name) _logger.exiting(class_name=_class_name, method_name=_method_name, result=classpath_string) return classpath_string
def _resolve_deployment_plan_path(self, plan_dir, plan_path): """ Find the deployment plan absolute file path. This is a private helper method. :param plan_dir: directory discovered from the domain, which is concatenated to the plan path :param plan_path: plan path discovered from the domain :return: absolute file path for the plan from the plan_dir and plan_paht """ if not StringUtils.isEmpty(plan_path): if not StringUtils.isEmpty(plan_dir): relative_to = plan_dir else: relative_to = self._model_context.get_domain_home() return discoverer.convert_to_absolute_path(relative_to, plan_path) return plan_path
def __get_domain_parent_dir(self, option_value): if StringUtils.isEmpty(option_value): domain_parent_dir = get_canonical_path( self.get_build_dir(), SystemTestSupport.DOMAIN_PARENT_DIR_DEFAULT) else: domain_parent_dir = get_canonical_file(option_value) return domain_parent_dir
def __get_logging_properties_file(self, option_value): if StringUtils.isEmpty(option_value): logging_properties_file = get_canonical_path( self.get_build_dir(), SystemTestSupport.LOG_PROPERTIES_FILE_DEFAULT) else: logging_properties_file = get_canonical_file(option_value) return logging_properties_file
def get_filename_from_path(file_path): """ Return the filename from the existing file path. :param file_path: path containing a file name :return: file name or None if a file name is not present or the file or file path does not exist """ file_name = None if not JStringUtils.isEmpty(file_path) and (os.path.exists(file_path) is False or os.path.isfile(file_path)): __, file_name = os.path.split(file_path) return file_name
def __get_supported_versions(self, option_value): """ Converts a string of comma-separated WLS versions into a Python list :param option_value: A comma-separated string of WLS versions (without the dots) :return: A Python list containing the supported WLS versions without the dots in them """ if StringUtils.isEmpty( option_value ) or option_value == SystemTestSupport.SUPPORTED_VERSIONS_ALL: supported_versions = SystemTestSupport.SUPPORTED_VERSIONS_DEFAULT else: supported_versions = [ x.strip() for x in option_value.split(',') if x ] return supported_versions
def __validate_locations_for_java_versions_required(self, env, version): _method_name = '__validate_locations_for_java_versions_required' _logger.entering(env, version, class_name=_class_name, method_name=_method_name) if version[-1] == '.': version = _get_dot_delimited_version(version) requires_java9 = self.does_wls_version_require_java9(version) requires_java8 = self.does_wls_version_require_java8(version) requires_java7 = self.does_wls_version_require_java7(version) java_home_name = None java_home_key = None validated = False if requires_java9: if self._java_homes.__contains__(SystemTestSupport._JAVA9): validated = True else: java_home_name = os.environ[ SystemTestSupport.JAVA9_HOME_ENVVAR] java_home_key = SystemTestSupport._JAVA9 elif requires_java8: if self._java_homes.__contains__(SystemTestSupport._JAVA8): validated = True else: java_home_name = os.environ[ SystemTestSupport.JAVA8_HOME_ENVVAR] java_home_key = SystemTestSupport._JAVA8 elif requires_java7: if self._java_homes.__contains__(SystemTestSupport._JAVA7): validated = True else: java_home_name = os.environ[ SystemTestSupport.JAVA7_HOME_ENVVAR] java_home_key = SystemTestSupport._JAVA7 else: ex = exception_helper.create_system_test_exception( 'WLSDPLY-09867', version) _logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex if not validated: if StringUtils.isEmpty(java_home_name): ex = exception_helper.create_system_test_exception( 'WLSDPLY-09868', version) _logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex java_home = get_canonical_file(java_home_name) if not java_home.exists(): _logger.finer('WLSDPLY-09886', java_home_name, class_name=_class_name, method_name=_method_name) elif not java_home.isDirectory(): _logger.finer('WLSDPLY-09887', java_home_name, class_name=_class_name, method_name=_method_name) self._java_homes[java_home_key] = java_home