Exemplo n.º 1
0
    def fix(self, missing, source, target, session):
        out = Tempout()
        out2 = Tempout()
        serviceproduction.handleGetProductionView(out, {}, session)
        result = out.loads()
        missings = result[3]
        elementId = None
        fileId = None
        newFileId = None
        for link in missings:
            if link["file_location"] == source and link["missing_file_location"] == missing:
                elementId = link["element_id"]
                fileId = link["file_id"]
        self.assertFalse(elementId == None)
        self.assertFalse(fileId == None)
        servicerefactor.handleGetMissingLinkSolutions(
            out2, {"production_id": session["production_id"], "element_id": elementId}, session
        )
        result2 = out2.loads()
        for solution in result2:
            if solution["file_location"] == target:
                newFileId = solution["file_id"]

        self.assertFalse(newFileId == None)
        servicerefactor.handleStartSolveMissingLink(Tempout(), {"file_id": newFileId, "element_id": elementId}, session)
        servicerefactor.handleExecuteCurrentTasks(Tempout(), {}, session)
Exemplo n.º 2
0
 def testScanProduction(self):
     refresh()
     serviceproduction.handleAdd(
         Tempout(), {"production_location": REPOSITORYLOCATION, "production_name": "unittest"}, {}
     )
     serviceproduction.handleActivateProduction(Tempout(), {"production_id": 1}, {})
     serviceproduction.handleGetProductionView(Tempout(), {}, {})
Exemplo n.º 3
0
    def fix(self, missing, source, target, session):
        out = Tempout()
        out2 = Tempout()
        serviceproduction.handleGetProductionView(out, {}, session)
        result = out.loads()
        missings = result[3]
        elementId = None
        fileId = None
        newFileId = None
        for link in missings:
            if link["file_location"] == source and link[
                    "missing_file_location"] == missing:
                elementId = link["element_id"]
                fileId = link["file_id"]
        self.assertFalse(elementId == None)
        self.assertFalse(fileId == None)
        servicerefactor.handleGetMissingLinkSolutions(
            out2, {
                "production_id": session["production_id"],
                "element_id": elementId
            }, session)
        result2 = out2.loads()
        for solution in result2:
            if solution["file_location"] == target:
                newFileId = solution["file_id"]

        self.assertFalse(newFileId == None)
        servicerefactor.handleStartSolveMissingLink(Tempout(), {
            "file_id": newFileId,
            "element_id": elementId
        }, session)
        servicerefactor.handleExecuteCurrentTasks(Tempout(), {}, session)
Exemplo n.º 4
0
 def testScanProduction(self):
     refresh()
     serviceproduction.handleAdd(
         Tempout(), {
             "production_location": REPOSITORYLOCATION,
             "production_name": "unittest"
         }, {})
     serviceproduction.handleActivateProduction(Tempout(),
                                                {"production_id": 1}, {})
     serviceproduction.handleGetProductionView(Tempout(), {}, {})
Exemplo n.º 5
0
    def renameFile(self, session, location, newName):
        out = Tempout()
        serviceproduction.handleGetProductionView(out, {}, session)
        result = out.loads()
        files = result[1]
        fileId = None
        for file in files:
            if file["file_location"] == location:
                fileId = file["file_id"]
        self.assertFalse(fileId == None)

        servicerefactor.handleStartRenameFile(Tempout(), {"file_id": fileId, "new_filename": newName}, session)
        servicerefactor.handleExecuteCurrentTasks(Tempout(), {}, session)
Exemplo n.º 6
0
    def renameFile(self, session, location, newName):
        out = Tempout()
        serviceproduction.handleGetProductionView(out, {}, session)
        result = out.loads()
        files = result[1]
        fileId = None
        for file in files:
            if file["file_location"] == location:
                fileId = file["file_id"]
        self.assertFalse(fileId == None)

        servicerefactor.handleStartRenameFile(Tempout(), {
            "file_id": fileId,
            "new_filename": newName
        }, session)
        servicerefactor.handleExecuteCurrentTasks(Tempout(), {}, session)
Exemplo n.º 7
0
    def renameElement(self,
                      session,
                      location,
                      elementName,
                      newName,
                      hasError=False):
        out = Tempout()
        out2 = Tempout()
        outresult = Tempout()
        serviceproduction.handleGetProductionView(out, {}, session)
        result = out.loads()
        files = result[1]
        fileId = None
        for file in files:
            if file["file_location"] == location:
                fileId = file["file_id"]

        self.assertFalse(fileId == None)

        serviceproduction.handleGetFileView(
            out2, {
                "file_id": fileId,
                "production_id": session["production_id"]
            }, session)
        result = out2.loads()
        elements = result[2]
        elementId = None
        for element in elements:
            if element["element_name"] == elementName:
                elementId = element["element_id"]

        servicerefactor.handleStartRenameElement(
            outresult, {
                "production_id": session["production_id"],
                "file_id": fileId,
                "element_id": elementId,
                "new_name": newName
            }, session)
        if hasError:
            result = outresult.loads()
            self.assertTrue("message" in result[0])
            return

        servicerefactor.handleExecuteCurrentTasks(Tempout(), {}, session)
Exemplo n.º 8
0
    def renameElement(self, session, location, elementName, newName, hasError=False):
        out = Tempout()
        out2 = Tempout()
        outresult = Tempout()
        serviceproduction.handleGetProductionView(out, {}, session)
        result = out.loads()
        files = result[1]
        fileId = None
        for file in files:
            if file["file_location"] == location:
                fileId = file["file_id"]

        self.assertFalse(fileId == None)

        serviceproduction.handleGetFileView(
            out2, {"file_id": fileId, "production_id": session["production_id"]}, session
        )
        result = out2.loads()
        elements = result[2]
        elementId = None
        for element in elements:
            if element["element_name"] == elementName:
                elementId = element["element_id"]

        servicerefactor.handleStartRenameElement(
            outresult,
            {
                "production_id": session["production_id"],
                "file_id": fileId,
                "element_id": elementId,
                "new_name": newName,
            },
            session,
        )
        if hasError:
            result = outresult.loads()
            self.assertTrue("message" in result[0])
            return

        servicerefactor.handleExecuteCurrentTasks(Tempout(), {}, session)
Exemplo n.º 9
0
    def doHandleService(self):
        try:
            servicename = self.path
            if servicename.find("?") != -1:
                servicename = servicename[0:servicename.find("?")]

            session = getSession(self.client_address[0])
            line = self.rfile.readline().decode();

            log.debug((servicename, line))
            req = json.loads(line)
            if servicename=="/service/metafromproductionfiles":
                servicescenes.handleGetAll(self.wfile, req, session)
            elif servicename=="/service/productions":
                serviceproduction.handleGetAll(self.wfile, req, session)
            elif servicename=="/service/deleteproduction":
                serviceproduction.handleDelete(self.wfile, req, session)
            elif servicename=="/service/addproduction":
                serviceproduction.handleAdd(self.wfile, req, session)
            elif servicename=="/service/activateproduction":
                serviceproduction.handleActivateProduction(self.wfile, req, session)
            elif servicename=="/service/productionview":
                serviceproduction.handleGetProductionView(self.wfile, req, session)
            elif servicename=="/service/fileview":
                serviceproduction.handleGetFileView(self.wfile, req, session)
            elif servicename=="/service/dependancy":
                servicedependancy.handleGet(self.wfile, req, session)
            elif servicename=="/service/renamefile":
                servicerefactor.handleStartRenameFile(self.wfile, req, session)
            elif servicename=="/service/movefile":
                servicerefactor.handleStartMoveFile(self.wfile, req, session)
            elif servicename=="/service/renamedir":
                servicerefactor.handleStartRenameDirectory(self.wfile, req, session)
            elif servicename=="/service/movedir":
                servicerefactor.handleStartMoveDirectory(self.wfile, req, session)
            elif servicename=="/service/renameelement":
                servicerefactor.handleStartRenameElement(self.wfile, req, session)
            elif servicename=="/service/refactoringtasks":
                servicerefactor.handleGetCurrentTasks(self.wfile, req, session)
            elif servicename=="/service/executetask":
                servicerefactor.handleExecuteOneTask(self.wfile, req, session)
            elif servicename=="/service/missinglinksolutions":
                servicerefactor.handleGetMissingLinkSolutions(self.wfile, req, session)
            elif servicename=="/service/solvemissinglink":
                servicerefactor.handleStartSolveMissingLink(self.wfile, req, session)
            elif servicename=="/service/svnadd":
                serviceproduction.handleSvnAdd(self.wfile, req, session)
            elif servicename=="/service/svnrevert":
                serviceproduction.handleSvnRevert(self.wfile, req, session)
            elif servicename=="/service/svnupdate":
                serviceproduction.handleSvnUpdate(self.wfile, req, session)
            elif servicename=="/service/svncommit":
                serviceproduction.handleSvnCommit(self.wfile, req, session)
#todo add service execute all tasks.

        except sqlite3.Error:
            traceback.print_exc()
            self.wfile.write("ERROR: A database error occured. Please check your database configuration in the settings file. Make sure you have removed the old database. If that does not solve the problem, send us an email.".encode())
        except IndexError:
            traceback.print_exc()
            self.wfile.write("ERROR: A database error occured. Please check your database configuration in the settings file. Make sure you have removed the old database. If that does not solve the problem, send us an email.".encode())
Exemplo n.º 10
0
    def doHandleService(self):
        try:
            servicename = self.path
            if servicename.find("?") != -1:
                servicename = servicename[0:servicename.find("?")]

            session = getSession(self.client_address[0])
            line = self.rfile.readline().decode()

            log.debug((servicename, line))
            req = json.loads(line)
            if servicename == "/service/metafromproductionfiles":
                servicescenes.handleGetAll(self.wfile, req, session)
            elif servicename == "/service/productions":
                serviceproduction.handleGetAll(self.wfile, req, session)
            elif servicename == "/service/deleteproduction":
                serviceproduction.handleDelete(self.wfile, req, session)
            elif servicename == "/service/addproduction":
                serviceproduction.handleAdd(self.wfile, req, session)
            elif servicename == "/service/activateproduction":
                serviceproduction.handleActivateProduction(
                    self.wfile, req, session)
            elif servicename == "/service/productionview":
                serviceproduction.handleGetProductionView(
                    self.wfile, req, session)
            elif servicename == "/service/fileview":
                serviceproduction.handleGetFileView(self.wfile, req, session)
            elif servicename == "/service/dependancy":
                servicedependancy.handleGet(self.wfile, req, session)
            elif servicename == "/service/renamefile":
                servicerefactor.handleStartRenameFile(self.wfile, req, session)
            elif servicename == "/service/movefile":
                servicerefactor.handleStartMoveFile(self.wfile, req, session)
            elif servicename == "/service/renamedir":
                servicerefactor.handleStartRenameDirectory(
                    self.wfile, req, session)
            elif servicename == "/service/movedir":
                servicerefactor.handleStartMoveDirectory(
                    self.wfile, req, session)
            elif servicename == "/service/renameelement":
                servicerefactor.handleStartRenameElement(
                    self.wfile, req, session)
            elif servicename == "/service/refactoringtasks":
                servicerefactor.handleGetCurrentTasks(self.wfile, req, session)
            elif servicename == "/service/executetask":
                servicerefactor.handleExecuteOneTask(self.wfile, req, session)
            elif servicename == "/service/missinglinksolutions":
                servicerefactor.handleGetMissingLinkSolutions(
                    self.wfile, req, session)
            elif servicename == "/service/solvemissinglink":
                servicerefactor.handleStartSolveMissingLink(
                    self.wfile, req, session)
            elif servicename == "/service/svnadd":
                serviceproduction.handleSvnAdd(self.wfile, req, session)
            elif servicename == "/service/svnrevert":
                serviceproduction.handleSvnRevert(self.wfile, req, session)
            elif servicename == "/service/svnupdate":
                serviceproduction.handleSvnUpdate(self.wfile, req, session)
            elif servicename == "/service/svncommit":
                serviceproduction.handleSvnCommit(self.wfile, req, session)
#todo add service execute all tasks.

        except sqlite3.Error:
            traceback.print_exc()
            self.wfile.write(
                "ERROR: A database error occured. Please check your database configuration in the settings file. Make sure you have removed the old database. If that does not solve the problem, send us an email."
                .encode())
        except IndexError:
            traceback.print_exc()
            self.wfile.write(
                "ERROR: A database error occured. Please check your database configuration in the settings file. Make sure you have removed the old database. If that does not solve the problem, send us an email."
                .encode())