コード例 #1
0
 def setUp(self):
     '''
     This method will be ran before EVERY unit test.
     '''
     # Create the database
     dbConfigurator = DBConfigurator("")
     dbConfigurator.runSQLScript("ClusterServerDBTest",
                                 "./ClusterServerDBTest.sql")
     # Add a user to it
     dbConfigurator.addUser("cygnuscloud", "cygnuscloud",
                            "ClusterServerDBTest")
     self.__connector = ClusterServerDatabaseConnector(
         "cygnuscloud", "cygnuscloud", "ClusterServerDBTest")
コード例 #2
0
 def connectToDatabase(self, mysqlRootsPassword, dbName, dbUser, dbPassword,
                       scriptPath):
     """
     Establishes a connection with the cluster server database.
     Args:
         mysqlRootsPassword: MySQL root's password
         dbName: the cluster server database's name
         dbUser: the cluster server database's user name
         dbPassword: the cluster server database's user password
         scriptPath: the cluster server database's initialization script path
     """
     configurator = DBConfigurator(mysqlRootsPassword)
     configurator.runSQLScript(dbName, scriptPath)
     configurator.addUser(dbUser, dbPassword, dbName, True)
     self.__dbConnector = ClusterServerDatabaseConnector(
         dbUser, dbPassword, dbName)
     self.__dbConnector.connect()
     self.__dbConnector.resetVMServersStatus()