

#Test all of the Postgres interfaces
from Ft.Lib import PgDatabase

from Ft.Ods.StorageManager.Adapters.Postgres import PManager
from Ft.Ods.StorageManager.Adapters.Postgres import PAdapter
from Ft.Ods.StorageManager.Adapters import Util



class Validator:

    def validateCreate(self,tester,dbName):
        tester.warning("Postgres, no create validation")
        return
        dbName,hostName,port,userName,passwd = Util.SplitDbConnectString(dbName)
        pg_db_name = "ftods__" + dbName
        tmpl_db = PgDatabase.Database('template1',hostName,port,userName,passwd)
        rt = tmpl_db.query("SELECT datname FROM pg_database where datname='%s'" % pg_db_name)
        return len(rt) != 0
        
    def validateDestroy(self,tester,dbName):
        tester.warning("Postgres, no destroy validation")
        return
        dbName,hostName,port,userName,passwd = Util.SplitDbConnectString(dbName)
        pg_db_name = "ftods__" + dbName
        tmpl_db = PgDatabase.Database('template1',hostName,port,userName,passwd)
        rt = tmpl_db.query("SELECT datname FROM pg_database where datname='%s'" % pg_db_name)
        return len(rt) == 0
        
    def validateInit(self,tester,dbName,mang):
        tester.warning("Postgres, no init validation")
        return




