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)
def setUp(self): dbConfigurator = DBConfigurator("") dbConfigurator.runSQLScript("ClusterEndpointDBTest", "./ClusterEndpointDBTest.sql") dbConfigurator.addUser("cygnuscloud", "cygnuscloud", "ClusterEndpointDBTest", True) self.__connector = ClusterEndpointDBConnector("cygnuscloud", "cygnuscloud", "ClusterEndpointDBTest")