
from Ft.Ods.StorageManager import Adapters

import os, string, time
DBNAME=os.environ.get("ODS_TEST_DB","ods:test")


def Test(tester):

    tester.startGroup("Create and Destroy %s Driver" % tester.test_data['driver'])
    mang = Adapters.GetManager()
    adapter = Adapters.GetAdapter()
    if mang.exists(DBNAME):
        mang.destroy(DBNAME)

    tester.startTest("New DB")
    mang.new(DBNAME,adapter)
    tester.testDone()

    time.sleep(1)

    tester.startTest("Clear")
    mang.clear(DBNAME)
    tester.testDone()

    time.sleep(1)

    tester.startTest("ReInit")
    mang.reinitRepo(DBNAME,adapter)
    tester.testDone()

    time.sleep(1)

    tester.startTest("Destroy")
    mang.destroy(DBNAME)
    tester.testDone()

    tester.startTest("Re create")
    mang.new(DBNAME,adapter)
    tester.testDone()
    tester.groupDone()


    time.sleep(1)


