# Path: opennsa/database.py
# LOG_SYSTEM = 'opennsa.Database'
#     DT = psycopg2.extensions.new_type((timestamptz_oid,), "timestamptz", castDatetime)
#     HASMANY = ['SubConnections']
#     BELONGSTO = ['ServiceConnection']
#     TABLENAME = 'stp_authz'
#     TABLENAME = 'backend_connection_id'
# def adaptLabel(label):
# def adaptSecuritAttribute(label):
# def adaptDatetime(dt):
#     def make(self, values):
#     def make(self, values):
# def castDatetime(value, cur):
# def setupDatabase(database, user, password=None, host=None, connection_id_start=None):
# def getBackendConnectionId():
#     def gotResult(rows):
# class LabelComposite(CompositeCaster):
# class SecuritAttributeComposite(CompositeCaster):
# class ServiceConnection(DBObject):
# class SubConnection(DBObject):
# class STPAuthz(DBObject):
# class BackendConnectionID(DBObject):


import json
from opennsa import database
# Common database stuff for test





# Trial switches the work directory to <project>/_trial_temp, so we go up a notch
CONFIG_FILE="../.opennsa-test.json"



def setupDatabase(config_file=CONFIG_FILE):

    tc = json.load( open(config_file) )


# Path: opennsa/database.py
# LOG_SYSTEM = 'opennsa.Database'
#     DT = psycopg2.extensions.new_type((timestamptz_oid,), "timestamptz", castDatetime)
#     HASMANY = ['SubConnections']
#     BELONGSTO = ['ServiceConnection']
#     TABLENAME = 'stp_authz'
#     TABLENAME = 'backend_connection_id'
# def adaptLabel(label):
# def adaptSecuritAttribute(label):
# def adaptDatetime(dt):
#     def make(self, values):
#     def make(self, values):
# def castDatetime(value, cur):
# def setupDatabase(database, user, password=None, host=None, connection_id_start=None):
# def getBackendConnectionId():
#     def gotResult(rows):
# class LabelComposite(CompositeCaster):
# class SecuritAttributeComposite(CompositeCaster):
# class ServiceConnection(DBObject):
# class SubConnection(DBObject):
# class STPAuthz(DBObject):
# class BackendConnectionID(DBObject):


# Path: test/db.py
import json
from opennsa import database

# Common database stuff for test





# Trial switches the work directory to <project>/_trial_temp, so we go up a notch
CONFIG_FILE="../.opennsa-test.json"



def setupDatabase(config_file=CONFIG_FILE):

    tc = json.load( open(config_file) )


    database.setupDatabase( tc['database'], tc['user'], tc['password'], host=tc['hostname'])