Exemplo n.º 1
0
 def setUp(self):
     # Create the database
     self.__dbConfigurator = DBConfigurator("")
     self.__dbConfigurator.runSQLScript("CommandsDBTest",
                                        "./CommandsDBTest.sql")
     # Add a user to it
     self.__dbConfigurator.addUser("cygnuscloud", "cygnuscloud",
                                   "CommandsDBTest")
     self.__connector = CommandsDatabaseConnector("cygnuscloud",
                                                  "cygnuscloud",
                                                  "CommandsDBTest", 1)
Exemplo n.º 2
0
 def connectToDatabases(self, endpointDBName, commandsDBName, databaseUser,
                        databasePassword):
     """
     Establishes the database connections
     Args:
         endpointDBName: the cluster endpoint database's name
         commandsDBName: the commands database's name
         databaseUser: the web application database user
         databasePassword: the web application database user password
     Returns:
         Nothing
     """
     self.__endpointDBConnector = MinimalClusterEndpointDBConnector(
         databaseUser, databasePassword, endpointDBName)
     self.__commandsDBConnector = CommandsDatabaseConnector(
         databaseUser, databasePassword, commandsDBName, 1)
Exemplo n.º 3
0
    def connectToDatabases(self, mysqlRootsPassword, endpointDBName,
                           commandsDBName, endpointdbSQLFilePath,
                           commandsDBSQLFilePath, websiteUser,
                           websiteUserPassword, endpointUser,
                           endpointUserPassword, minCommandInterval):
        """
        Establishes the connection with the two databases
        Args:
            mysqlRootsPassword: the MySQL root's password
            endpointDBName: the endpoint database's name
            endpointdbSQLFilePath: the endpoint database's schema definition file path
            websiteUser: the web application's username
            websiteUserPassword: the web application's username
            endpointUser: the endpoint daemon user's name
            endpointUserPassword: the endpoint daemon user's password
        """
        self.__rootsPassword = mysqlRootsPassword
        self.__statusDatabaseName = endpointDBName
        self.__commandsDatabaseName = commandsDBName
        configurator = DBConfigurator(mysqlRootsPassword)
        configurator.runSQLScript(endpointDBName, endpointdbSQLFilePath,
                                  "root", mysqlRootsPassword)
        configurator.runSQLScript(commandsDBName, commandsDBSQLFilePath,
                                  "root", mysqlRootsPassword)

        configurator.addUser(websiteUser, websiteUserPassword, endpointDBName,
                             False)
        configurator.addUser(endpointUser, endpointUserPassword,
                             endpointDBName, True)
        configurator.addUser(websiteUser, websiteUserPassword, commandsDBName,
                             True)
        configurator.addUser(endpointUser, endpointUserPassword,
                             commandsDBName, True)

        self.__commandsDBConnector = CommandsDatabaseConnector(
            endpointUser, endpointUserPassword, commandsDBName,
            minCommandInterval)
        self.__endpointDBConnector = ClusterEndpointDBConnector(
            endpointUser, endpointUserPassword, endpointDBName)