def _verify_attribute_set_method(self, folder_name, attribute_name,
                                     wlst_mode, attribute_value, aliases):
        result = []
        resolved_attribute = aliases._resolve_curly_braces(attribute_value)
        if resolved_attribute:
            if not resolved_attribute.startswith('MBEAN'):
                message = self._get_invalid_alias_attribute_value_message(
                    folder_name, attribute_name, SET_METHOD,
                    WlstModes.from_value(wlst_mode), resolved_attribute,
                    'it does not start with MBEAN')
                result.append(message)
            else:
                set_method_value_components = resolved_attribute.split('.')
                if len(set_method_value_components) == 2:
                    invoker = set_method_value_components[1]

                    instance = AttributeSetter(aliases, None,
                                               ExceptionType.ALIAS, wlst_mode)
                    try:
                        getattr(instance, invoker)
                    except AttributeError:
                        result.append(
                            self.set_method_not_found_message(
                                folder_name, attribute_name,
                                WlstModes.from_value(wlst_mode), invoker))
        return result
Пример #2
0
def str_mode(model_context):
    """
    Return the string representation of the current wlst mode in process - online or offline
    :param model_context: containing the mode currently being used in the test processing
    :return: string representation of the current mode
    """
    return WlstModes.from_value(model_context.get_target_wlst_mode())
Пример #3
0
def __discover(model_context, aliases, injector, helper):
    """
    Populate the model from the domain.
    :param model_context: the model context
    :param aliases: aliases instance for discover
    :param injector: variable injector instance
    :param helper: wlst_helper instance
    :return: the fully-populated model
    :raises DiscoverException: if an error occurred while discover the domain
    """
    _method_name = '__discover'
    model = Model()
    base_location = LocationContext()
    __connect_to_domain(model_context, helper)
    try:
        _add_domain_name(base_location, aliases, helper)
        DomainInfoDiscoverer(model_context, model.get_model_domain_info(), base_location, wlst_mode=__wlst_mode,
                             aliases=aliases, variable_injector=injector).discover()
        TopologyDiscoverer(model_context, model.get_model_topology(), base_location, wlst_mode=__wlst_mode,
                           aliases=aliases, variable_injector=injector).discover()
        ResourcesDiscoverer(model_context, model.get_model_resources(), base_location, wlst_mode=__wlst_mode,
                            aliases=aliases, variable_injector=injector).discover()
        DeploymentsDiscoverer(model_context, model.get_model_app_deployments(), base_location, wlst_mode=__wlst_mode,
                              aliases=aliases, variable_injector=injector).discover()
        __discover_multi_tenant(model, model_context, base_location, aliases, injector)
    except AliasException, ae:
        wls_version = WebLogicHelper(__logger).get_actual_weblogic_version()
        wlst_mode = WlstModes.from_value(__wlst_mode)
        ex = exception_helper.create_discover_exception('WLSDPLY-06000', model_context.get_domain_name(),
                                                        model_context.get_domain_home(), wls_version, wlst_mode,
                                                        ae.getLocalizedMessage(), error=ae)
        __logger.throwing(ex, class_name=_class_name, method_name=_method_name)
        raise ex
Пример #4
0
def get_dictionary(model_context):
    _method_name = 'get_dictionary'
    __logger.entering(class_name=CLASS_NAME, method_name=_method_name)
    dictionary = all_utils.get_dictionary_from_json_file(
        all_utils.filename(
            all_utils.generated_filename(),
            WlstModes.from_value(model_context.get_target_wlst_mode()),
            model_context.get_target_wls_version().replace('.', '')))
    __logger.exiting(class_name=CLASS_NAME, method_name=_method_name)
    return dictionary
def get_dictionary():
    _method_name = 'get_dictionary'
    __logger.entering(class_name=CLASS_NAME, method_name=_method_name)
    dictionary = \
        all_utils.get_dictionary_from_json_file(all_utils.filename(generator_helper.filename(),
                                                                   WlstModes.from_value(WlstModes.ONLINE),
                                                                   generator_wlst.wls_version().replace('.', '')))
    __logger.exiting(class_name=CLASS_NAME,
                     method_name=_method_name,
                     result=len(dictionary))
    return dictionary
Пример #6
0
def populate_model_context(program_name, wlst_mode, kwargs):
    """
    Create a model context with the values for this instance of the system test.
    Aliases requires a populated model context, so this will be used to encapsulate
    the runtime values for the system test use.
    :param program_name: name of the program for logging purposes
    :param wlst_mode: online or offline
    :param kwargs: map of the command line arguments
    :return: verify context encapsulating runtime information
    """
    kwargs[CommandLineArgUtil.TARGET_MODE_SWITCH] = WlstModes.from_value(
        wlst_mode)
    return VerifyContext(program_name, kwargs)
 def _get_wlst_mode_string(self):
     """
      Helper method to return the string representation for the online/offline mode of discovery.
      :return: String representation of mode
     """
     return WlstModes.from_value(self._wlst_mode)