def testMatchesEmptyJarray(self):
     jarray_value = None
     expected_value = []
     jarray_default = jarray.array([], String)
     converted_type, converted_value = self._custom_helper.convert(
         jarray_value, '[L')
     self.common_test_converted(expected_value, alias_constants.JARRAY,
                                converted_value, converted_type)
     self.common_test_default(jarray_default, 'PyArray', converted_value,
                              converted_type, True)
 def testJarryDoesNotEqualDefaultDiffLength(self):
     jarray_value = jarray.array(['idcs_user_assertion'], String)
     expected_value = ['idcs_user_assertion']
     jarray_default = ['idcs_user_assertion', 'Idcs_user_assertion']
     converted_type, converted_value = self._custom_helper.convert(
         jarray_value, 'PyArray')
     self.common_test_converted(expected_value, alias_constants.JARRAY,
                                converted_value, converted_type)
     self.common_test_default(jarray_default, 'PyArray', converted_value,
                              converted_type, False)
 def testJarrayEqualsDefault(self):
     jarray_value = jarray.array(
         ['Idcs_user_assertion', 'idcs_user_assertion'], String)
     expected_value = ['Idcs_user_assertion', 'idcs_user_assertion']
     jarray_default = ['idcs_user_assertion', 'Idcs_user_assertion']
     converted_type, converted_value = self._custom_helper.convert(
         jarray_value, '[L')
     self.common_test_converted(expected_value, alias_constants.JARRAY,
                                converted_value, converted_type)
     self.common_test_default(jarray_default, str(type(jarray_default)),
                              converted_value, converted_type, True)
    def __build_server_mbean_list(self, value, wlst_value):
        """
        Construct the server MBean list.
        :param value: the value
        :param wlst_value: the existing value from WLST
        :return: the Java array of MBeans ObjectNames
        :raises BundleAwareException of the specified type: if an error occurs
        """
        server_names = TypeUtils.convertToType(List, value)  # type: list of str
        server_names = self.__merge_existing_items(server_names, wlst_value)

        name_list = []
        for server_name in server_names:
            mbean = self.__find_in_location(LocationContext(), SERVER, server_name, required=True)
            name_list.append(mbean.getObjectName())

        return jarray.array(name_list, ObjectName)
    def __build_target_mbean_list(self, target_value, wlst_value, location, include_jms=False):
        """
        Construct the target MBean list.
        :param target_value: the target value
        :param wlst_value: the existing value from WLST
        :param include_jms: whether or not to include JMS targets, the default is False
        :return: the Java array of MBeans ObjectNames
        :raises BundleAwareException of the specified type: if an error occurs
        """
        target_names = TypeUtils.convertToType(List, target_value)  # type: list of str
        target_names = self.__merge_existing_items(target_names, wlst_value)

        name_list = []
        for target_name in target_names:
            target_mbean = self.__find_target(target_name, location, include_jms=include_jms)
            name_list.append(target_mbean.getObjectName())

        return jarray.array(name_list, ObjectName)
    def __build_virtual_target_mbean_list(self, target_value, wlst_value):
        """
        Construct the virtual target MBean list.
        :param target_value: the target value
        :param wlst_value: the existing value from WLST
        :return: for offline, a list of MBeans; for online, a jarray of MBean ObjectNames
        :raises BundleAwareException of the specified type: if an error occurs
        """
        target_names = TypeUtils.convertToType(List, target_value)  # type: list of str
        target_names = self.__merge_existing_items(target_names, wlst_value)

        if self.__wlst_mode == WlstModes.ONLINE:
            name_list = []
            for target_name in target_names:
                target_mbean = self.__find_in_location(LocationContext(), VIRTUAL_TARGET, target_name, required=True)
                name_list.append(target_mbean.getObjectName())
            return jarray.array(name_list, ObjectName)
        else:
            mbean_list = []
            for target_name in target_names:
                target_mbean = self.__find_in_location(LocationContext(), VIRTUAL_TARGET, target_name, required=True)
                mbean_list.append(target_mbean)
            return mbean_list