コード例 #1
0
class List_t(unittest.TestCase):
    @DaoConfig("DBSReader")
    def __init__(self, methodName='runTest'):
        super(List_t, self).__init__(methodName)
        #use persistent data, since inserts are not foreseen
        self.data_provider = create_dbs_data_provider(data_type='persistent')
        self.data = set((data['data_type'] for data in self.data_provider.get_primary_ds_type_data()))

    def setUp(self):
        """setup all necessary parameters"""
        self.conn = self.dbi.connection()
        self.dao = PrimaryDSTypeList(self.logger, self.dbi, self.dbowner)

    def tearDown(self):
        """Clean-up all necessary parameters"""
        self.conn.close()

    def test01(self):
        """dao.Oracle.PrimaryDSType.List: Basic"""
        result = self.dao.execute(self.conn)
        self.assertTrue(isinstance(result, list))

    def test02(self):
        """dao.Oracle.PrimaryDSType.List: Basic"""
        result = set((data['data_type'] for data in self.dao.execute(self.conn, dsType="%")))
        self.assertTrue(self.data.issubset(result))

    def test03(self):
        """dao.Oracle.PrimaryDSType.List: Basic"""
        result = self.dao.execute(self.conn, "ThisDoesNotExist")
        self.assertTrue(isinstance(result, list))
        self.assertEqual(len(result), 0)
コード例 #2
0
ファイル: TestDAO.py プロジェクト: PerilousApricot/DBS
 def test01(self):
     """PrimaryDSType.List"""
     from dbs.dao.Oracle.PrimaryDSType.List import List as PrimaryDSTypeList
     dao = PrimaryDSTypeList(self.logger, self.dbi)
     dao.execute()
     result = dao.execute("ThisDoesNotExist")
     self.assertEqual(len(result), 0)
コード例 #3
0
 def test01(self):
     """PrimaryDSType.List"""
     from dbs.dao.Oracle.PrimaryDSType.List import List as PrimaryDSTypeList
     dao = PrimaryDSTypeList(self.logger, self.dbi)
     dao.execute()
     result = dao.execute("ThisDoesNotExist")
     self.assertEqual(len(result), 0)
コード例 #4
0
ファイル: Insert_t.py プロジェクト: bbockelm/DBS-1
 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)
コード例 #5
0
ファイル: Insert_t.py プロジェクト: bbockelm/DBS-1
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()
コード例 #6
0
ファイル: Insert_t.py プロジェクト: AndresTanasijczuk/DBS
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()
コード例 #7
0
ファイル: Insert_t.py プロジェクト: AndresTanasijczuk/DBS
 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)
コード例 #8
0
 def setUp(self):
     """setup all necessary parameters"""
     self.conn = self.dbi.connection()
     self.dao = PrimaryDSTypeList(self.logger, self.dbi, self.dbowner)