Example #1
0
    def _get_ucase_class_from_ucase(self, ucase):
        """
        This function gets the use case class from the use case name.

        :type   ucase: string
        :param  ucase: use case name

        :rtype:     object
        :return:    use case class
        """

        if not self._ucase_catalogs:
            error_msg = "No use case catalog has been found!"
            raise AcsConfigException(AcsConfigException.FILE_NOT_FOUND,
                                     error_msg)

        ucase_dic = self._ucase_catalogs.get(ucase)

        if not ucase_dic:
            error_msg = "Use case {0} not found in UC catalog!".format(ucase)
            raise AcsConfigException(AcsConfigException.XML_PARSING_ERROR,
                                     error_msg)

        # Presence of ClassName element is already checked by CatalogParser using xsd
        ucase_class_name = ucase_dic.get(CatalogParser.CLASSNAME_ELEM)
        ucase_class = Utils.get_class(ucase_class_name)
        return ucase_class
Example #2
0
 def get_ucase_class(self):
     """
     This function returns usecase class if present.
     """
     ucase_class = None
     ucase_class_node = self.get_testcase_property(USECASE_CLASS_NAME_NODE,
                                                   None)
     if ucase_class_node is not None:
         ucase_class = Utils.get_class(ucase_class_node)
     return ucase_class