Esempio n. 1
0
class TestUserMetadataBasicTestCase(unittest.TestCase):
    def setUp(self):
        self.dirac = Dirac()
        csAPI = CSAPI()

        self.lfn5 = os.path.join(DESTINATION_PATH, 'test_file_10MB_v5.bin')
        self.dir5 = os.path.dirname(self.lfn5)
        # local file, for now:
        self.fname = os.path.basename(self.lfn5)
        random_dd(self.fname, 10)
        self.diracSE = 'SE-1'
        try:
            self.fc = FileCatalog(['MultiVOFileCatalog'])
        except Exception:
            self.fail(
                " FileCatalog(['MultiVOFileCatalog']) raised Exception unexpectedly!\n"
                + traceback.format_exc())
            return
        # add a replica
        self.fileadded = self.dirac.addFile(self.lfn5, self.fname,
                                            self.diracSE)
        self.assertTrue(self.fileadded['OK'])

    def tearDown(self):
        # meta index -r
        result = self.fc.deleteMetadataField('MetaInt6')
        self.assertTrue(result['OK'])
        result = self.fc.deleteMetadataField('TestDirectory6')
        self.assertTrue(result['OK'])
        # remove the MultiVOFileCatalog
        self.fc.removeCatalog('MultiVOFileCatalog')
        # delete a sole replica: dirac-dms-remove-files
        result = self.dirac.removeFile(self.lfn5)
        self.assertTrue(result['OK'])
        os.remove(self.fname)
Esempio n. 2
0
class TestClientProductionTestCase(unittest.TestCase):
    def setUp(self):
        self.prodClient = ProductionClient()
        self.transClient = TransformationClient()
        self.fc = FileCatalog()

        # ## Add metadata fields to the DFC
        self.MDFieldDict = {
            'particle': 'VARCHAR(128)',
            'analysis_prog': 'VARCHAR(128)',
            'tel_sim_prog': 'VARCHAR(128)',
            'outputType': 'VARCHAR(128)',
            'zenith': 'int',
            'data_level': 'int'
        }
        for MDField in self.MDFieldDict:
            MDFieldType = self.MDFieldDict[MDField]
            res = self.fc.addMetadataField(MDField, MDFieldType)
            self.assert_(res['OK'])

    def tearDown(self):
        # Delete meta data fields
        for MDField in self.MDFieldDict:
            res = self.fc.deleteMetadataField(MDField)
            self.assert_(res['OK'])
Esempio n. 3
0
class TestClientProductionTestCase(unittest.TestCase):
    def setUp(self):
        self.prodClient = ProductionClient()
        self.transClient = TransformationClient()
        self.fc = FileCatalog()

        # ## Add metadata fields to the DFC
        self.MDFieldDict = {
            "particle": "VARCHAR(128)",
            "analysis_prog": "VARCHAR(128)",
            "tel_sim_prog": "VARCHAR(128)",
            "outputType": "VARCHAR(128)",
            "zenith": "int",
            "data_level": "int",
        }
        for MDField in self.MDFieldDict:
            MDFieldType = self.MDFieldDict[MDField]
            res = self.fc.addMetadataField(MDField, MDFieldType)
            self.assert_(res["OK"])

    def tearDown(self):
        # Delete meta data fields
        for MDField in self.MDFieldDict:
            res = self.fc.deleteMetadataField(MDField)
            self.assert_(res["OK"])