Esempio n. 1
0
 def setUp(self):
     LOG.set_none()
     self.stale_plugins = Mock()
     self.stale_plugins.expect_get_bundled_plugins_module(toReturn=['bundled_plugins'])
     self.stale_plugins.default_find_plugins_to_recompile([])
     self.module = Run(self.stale_plugins)
     self.module._Run__build_tomcat_layout = lambda args: None
Esempio n. 2
0
 def call(self):
     super().__call__(LOG)
     for line in self.output:
         if self.returncode:
             if line: LOG.error(line)
         else:
             if line: LOG.trace(line)
     return self.output
Esempio n. 3
0
 def _is_robot_suite_file(self, file):
     try:
         tc = TestData(source=file)
         return tc.has_tests()
     except Exception, err:
         LOG.warn(
             "Parse %s met exception, may not be a valid robot suite file. %s"
             % (file, err.message))
Esempio n. 4
0
 def call(self):
     super().__call__(LOG)
     for line in self.output:
         if self.returncode:
             if line: LOG.error(line)
         else:
             if line: LOG.trace(line)
     return self.output
Esempio n. 5
0
 def _get_db(self):
     host = self.config.getoption('db_host')
     port = int(self.config.getoption('db_port'))
     db_name = self.config.getoption('db_name')
     try:
         c = Connection(host=host, port=port)
     except ConnectionFailure, err:
         LOG.error("Could not connect to mongodb, %s" % err.message)
         sys.exit(1)
Esempio n. 6
0
 def setUp(self):
     LOG.set_none()
     self.layout = MockLayout(True)
     self.horde_layout = HordeLayout(self.layout.jira_home())
     self.args = Mock()
     self.args.layout = self.layout
     self.args.horde_layout = self.horde_layout
     self.args.with_workspace = False
     self.args.mvn_clean = False
     self.horde_status_checker = MockStatusChecker()
Esempio n. 7
0
 def setUp(self):
     LOG.set_none()
     self.layout = MockLayout(True)
     self.horde_layout = HordeLayout(self.layout.jira_home())
     self.args = Mock()
     self.args.layout = self.layout
     self.args.horde_layout = self.horde_layout
     self.args.with_workspace = False
     self.args.mvn_clean = False
     self.horde_status_checker = MockStatusChecker()
Esempio n. 8
0
 def parse_robot_suites(self, path):
     robotcases = []
     for root, dirnames, filenames in os.walk(path):
         for fileType in CaseImporter.ROBOT_FILE_TYPES:
             for filename in fnmatch.filter(filenames, fileType):
                 file = os.path.join(root, filename)
                 LOG.info("Parse %s" % file)
                 if self._is_robot_suite_file(file):
                     tc = self._parse_robot_suite_file(file)
                     robotcases.append(tc)
     return robotcases
Esempio n. 9
0
    def dispatch_from_params(self, argv):
        main_help = 'jmake is a primary tool for JIRA devs.'

        parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
        self.__register_submodules(parser, MainModule(parser).get_submodules())
        self.__discover_help(main_help, parser)

        if argv[1:]:
            args = parser.parse_args(
                [arg for arg in argv[1:] if arg != 'clean' or argv[1] == arg or argv[1] == 'auto-complete'])

            args.mvn_clean = 'clean' in argv[2:]
            if args.func.check_branch and not 'JMAKE_DRY' in os.environ:
                git_branch = GitBranchDiscovery()
                self.executor.append(git_branch)
                if not args.mvn_clean:
                    self.executor.append(BranchInconsistencyCheck(git_branch))
                self.executor.append_post(BranchInconsistencyMarker(git_branch))

            try:
                args.func(args, self.executor)
            except Exception as e:
                self.executor.commands = [ lambda logger : logger.error('Exception occurred during preparing executor: %s' % str(e)) or Callable.success]
                self.executor.post_commands = []
                traceback.print_exc()
                return self.executor.execute()

            if args.log_level:
                try:
                    getattr(LOG, 'set_' + args.log_level)()
                except AttributeError:
                    LOG.error('Cannot set log level to %s' % args.log_level)
                    return Callable.failure

            if args.silent: args.func.prevent_post_commands = True
            if not args.func.prevent_post_commands:
                timer = ExecutionTimeCallable()
                self.executor.append_post(timer)
                if os.getenv('JMAKE_STFU') is None:
                    self.executor.append_post(Notifier(timer))
            if args.func.prevent_console_reset:
                self.executor.perform_console_reset = False
            if not args.func.prevent_post_diagnostics:
                self.__append_post_diagnostics()
        else:
            parser.print_help()
            self.__append_post_diagnostics()

        return self.executor.execute()
Esempio n. 10
0
    def add_plugins_maven_goals(self, args, maven):
        profiles_for_plugins = self.add_devmode_plugins(args, maven)

        if not args.bundled_plugins:
            maven.property('jira.exclude.bundled.plugins')

        if args.mvn_clean:
            LOG.info('Clean parameter present recompiling bundled plugins')
            modules_to_build = self.stale_plugins.get_bundled_plugins_module()
        else:
            modules_to_build = self.stale_plugins.find_plugins_to_recompile(profiles_for_plugins)

        for module in modules_to_build:
            maven.project(module)

        if len(modules_to_build) == 0:
            LOG.info('Bundled plugins up to date skipping compilation')
Esempio n. 11
0
    def add_plugins_maven_goals(self, args, maven):
        profiles_for_plugins = self.add_devmode_plugins(args, maven)

        if not args.bundled_plugins:
            maven.property('jira.exclude.bundled.plugins')

        if args.mvn_clean:
            LOG.info('Clean parameter present recompiling bundled plugins')
            modules_to_build = self.stale_plugins.get_bundled_plugins_module()
        else:
            modules_to_build = self.stale_plugins.find_plugins_to_recompile(
                profiles_for_plugins)

        for module in modules_to_build:
            maven.project(module)

        if len(modules_to_build) == 0:
            LOG.info('Bundled plugins up to date skipping compilation')
Esempio n. 12
0
    def import_to_db(self, project, testCasePath):
        suites = self.parse_robot_suites(testCasePath)

        db = self._get_db()
        caseProject = db.project.find_one({"name": project})
        LOG.info(caseProject)
        if not caseProject:
            db.project.insert({"name": project})
        caseProject = db.project.find_one({"name": project})
        if 'suites' in caseProject:
            db.suite.remove({
                "_id": {
                    "$in": [suite.id for suite in caseProject["suites"]]
                }
            })
        db.suite.insert(suites)
        db.suite.create_index([('doc', pymongo.TEXT)])
        projectSuites = [DBRef("suites", suite["_id"]) for suite in suites]
        caseProject = deepcopy(caseProject)
        caseProject["suites"] = projectSuites
        db.project.update({"name": project}, caseProject)
 def setUpClass(cls):
     LOG.set_none()
Esempio n. 14
0
 def setUp(self):
     self.layout = MockLayout(False)
     LOG.set_none()
Esempio n. 15
0
#!/usr/bin/env python3
import sys
from CommandDispatcher import CommandDispatcher
from CommandExecutor import CommandExecutor
from Logger import LOG


dispatcher = CommandDispatcher(CommandExecutor().set_logger(LOG.set_debug()))
sys.exit(dispatcher.dispatch_from_params(sys.argv))






Esempio n. 16
0
 def setUpClass(cls):
     LOG.set_none()
Esempio n. 17
0
 def log(self, msg):
     LOG.info(msg)
 def log(self, msg):
     LOG.info(msg)