Ejemplo n.º 1
0
    def run(self,url):
        printout("Running Bicho with delay of %s seconds" % (str(self.delay)))

        bugsdb = get_database(DBJiraBackend())

        bugsdb.insert_supported_traker("jira","4.1.2")
        trk = Tracker(url.split("-")[0], "jira", "4.1.2")
        dbtrk = bugsdb.insert_tracker(trk)

        serverUrl = url.split("/browse/")[0]
        query = "/si/jira.issueviews:issue-xml/"
        project = url.split("/browse/")[1]

        if (project.split("-").__len__() > 1):
            bug_key = project
            project = project.split("-")[0]
            bugs_number = 1

            printdbg(serverUrl + query + bug_key + "/" + bug_key + ".xml")

            parser = xml.sax.make_parser(  )
            handler = BugsHandler(  )
            parser.setContentHandler(handler)
            try:
                parser.parse(serverUrl + query + bug_key + "/" + bug_key + ".xml")
                issue = handler.getIssue()
                bugsdb.insert_issue(issue, dbtrk.id)
            except Exception, e:
                #printerr(e)
                print(e)
Ejemplo n.º 2
0
                parser.parse(serverUrl + query + bug_key + "/" + bug_key + ".xml")
                issue = handler.getIssue()
                bugsdb.insert_issue(issue, dbtrk.id)
            except Exception, e:
                #printerr(e)
                print(e)

        else:
            bugs_number = self.bugsNumber(url)

            for i in range(int(bugs_number)+1):
                if i != 0:
                    bug_key = project + "-" + str(i)
                    printdbg(serverUrl + query + bug_key + "/" + bug_key + ".xml")

                    parser = xml.sax.make_parser(  )
                    handler = BugsHandler(  )
                    parser.setContentHandler(handler)
                    try:
                        parser.parse(serverUrl + query + bug_key + "/" + bug_key + ".xml")
                        issue = handler.getIssue()
                        bugsdb.insert_issue(issue, dbtrk.id)
                    except Exception, e:
                        #printerr(e)
                        print(e)
                    time.sleep(self.delay)

        printout("Done. %s bugs analyzed" % (bugs_number))

register_backend ("jira", JiraBackend)