def testPrimaryInsert(self): """ This method is being used for testing primary datasets's insert DAO """ dao = PriInsert(self.logger, self.dbi, "") dinput = { "JUNK" : "XYZ" , "primary_ds_id":1001, "primary_ds_name": "TkCosmics38T", "primary_ds_type_id": 1, "creation_date": 1234, "create_by":"anzar"} dao.execute(dinput)
def test02(self): """PrimaryDataset.Insert""" from dbs.dao.Oracle.PrimaryDataset.Insert import Insert as PrimaryDatasetInsert dao = PrimaryDatasetInsert(self.logger, self.dbi) dinput = {"primarydsid":INSERTCOUNT, "primarydsname":"QCD_100_" + INSERTCOUNT, "primarydstypeid":1, "creationdate":1234, "createby":"akhukhunATcern.ch"} dao.execute(dinput)
def testPrimaryInsert(self): """ This method is being used for testing primary datasets's insert DAO """ dao = PriInsert(self.logger, self.dbi, "") dinput = { "JUNK": "XYZ", "primary_ds_id": 1001, "primary_ds_name": "TkCosmics38T", "primary_ds_type_id": 1, "creation_date": 1234, "create_by": "anzar" } dao.execute(dinput)
class Insert_t(unittest.TestCase): @DaoConfig("DBSWriter") def __init__(self, methodName='runTest'): super(Insert_t, self).__init__(methodName) data_location = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'test_data.pkl') self.data_provider = create_dbs_data_provider( data_type='transient', data_location=data_location) self.data = self.data_provider.get_primary_dataset_data( regenerate=True)[0] def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.primary_dataset_insert = PrimaryDatasetInsert( self.logger, self.dbi, self.dbowner) self.primary_ds_type = PrimaryDSTypeList(self.logger, self.dbi, self.dbowner) self.sequence_manager = SequenceManager(self.logger, self.dbi, self.dbowner) def tearDown(self): """Clean-up all necessary parameters""" self.conn.close() def test01(self): """dao.Oracle.PrimaryDataset.Insert: Basic""" tran = self.conn.begin() try: self.data["primary_ds_type_id"] = (self.primary_ds_type.execute( self.conn, self.data["primary_ds_type"], transaction=tran))[0]["primary_ds_type_id"] del self.data["primary_ds_type"] self.data["primary_ds_id"] = self.sequence_manager.increment( self.conn, "SEQ_PDS", tran) self.primary_dataset_insert.execute(self.conn, self.data) except Exception as ex: tran.rollback() raise ex else: tran.commit() finally: if tran: tran.close()
def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.primary_dataset_insert = PrimaryDatasetInsert( self.logger, self.dbi, self.dbowner) self.primary_ds_type = PrimaryDSTypeList(self.logger, self.dbi, self.dbowner) self.sequence_manager = SequenceManager(self.logger, self.dbi, self.dbowner)
class Insert_t(unittest.TestCase): @DaoConfig("DBSWriter") def __init__(self, methodName="runTest"): super(Insert_t, self).__init__(methodName) data_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_data.pkl") self.data_provider = create_dbs_data_provider(data_type="transient", data_location=data_location) self.data = self.data_provider.get_primary_dataset_data(regenerate=True)[0] def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.primary_dataset_insert = PrimaryDatasetInsert(self.logger, self.dbi, self.dbowner) self.primary_ds_type = PrimaryDSTypeList(self.logger, self.dbi, self.dbowner) self.sequence_manager = SequenceManager(self.logger, self.dbi, self.dbowner) def tearDown(self): """Clean-up all necessary parameters""" self.conn.close() def test01(self): """dao.Oracle.PrimaryDataset.Insert: Basic""" tran = self.conn.begin() try: self.data["primary_ds_type_id"] = ( self.primary_ds_type.execute(self.conn, self.data["primary_ds_type"], transaction=tran) )[0]["primary_ds_type_id"] del self.data["primary_ds_type"] self.data["primary_ds_id"] = self.sequence_manager.increment(self.conn, "SEQ_PDS", tran) self.primary_dataset_insert.execute(self.conn, self.data) except Exception as ex: tran.rollback() raise ex else: tran.commit() finally: if tran: tran.close()
def setUp(self): """setup all necessary parameters""" self.conn = self.dbi.connection() self.primary_dataset_insert = PrimaryDatasetInsert(self.logger, self.dbi, self.dbowner) self.primary_ds_type = PrimaryDSTypeList(self.logger, self.dbi, self.dbowner) self.sequence_manager = SequenceManager(self.logger, self.dbi, self.dbowner)