Changeset 5240 for TI01-discovery


Ignore:
Timestamp:
30/04/09 11:19:53 (10 years ago)
Author:
cbyrom
Message:

Add data access methods to retrieve all provider information and add
tests to exercise these new methods.

Location:
TI01-discovery/trunk/OAIInfoEditor/oai_info_editor
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/dal/editorfileclient.py

    r5238 r5240  
    225225    def getProviderInfo(self, providerInfoName): 
    226226        ''' 
    227         Get the change request details for the specified list 
     227        Get the provider info details for the specified name 
    228228        @param providerInfoName: name of the provider info to retrieve  
    229229        @return ProviderInfo: object with requested data - or None if no data found 
     
    240240             
    241241        return pi 
     242 
     243 
     244    def getAllProviderInfo(self): 
     245        ''' 
     246        Get all provider info 
     247        @return ProviderInfo list: list of ProviderInfo objects representing all provider info data 
     248        '''  
     249        logging.info("Retrieving all provider info data") 
     250        self.pic, fileName = self.__getProviderInfoData() 
     251             
     252        return self.pic.providerInfos 
    242253         
    243254         
  • TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/dal/interfaceeditordbclient.py

    r5238 r5240  
    4747                                  "been implemented yet") 
    4848 
     49 
     50    def getAllProviderInfo(self): 
     51        ''' 
     52        Get all provider info 
     53        @return ProviderInfo list: list of ProviderInfo objects representing all provider info data 
     54        '''  
     55        raise NotImplementedError("This is an interface class and this method has not " + \ 
     56                                  "been implemented yet") 
     57 
    4958                
    5059    def getRepositoryInfo(self, providerInfoName, repositoryInfoName): 
  • TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/dal/providerinfodao.py

    r5238 r5240  
    9898        return self.client.getProviderInfo(providerInfoName) 
    9999         
     100 
     101    def getAllProviderInfo(self): 
     102        ''' 
     103        Get all provider info 
     104        @return ProviderInfo list: list of ProviderInfo objects representing all provider info data 
     105        '''  
     106        return self.client.getAllProviderInfo() 
     107 
    100108         
    101109    def getRepositoryInfo(self, providerInfoName, repositoryInfoName): 
  • TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/tests/dal/testeditorfileclient.py

    r5238 r5240  
    141141 
    142142 
     143    def testGetAllProviderInfo(self): 
     144        pi, fileName = self.client.createProviderInfo(PROVIDER_INFO_1) 
     145        self.files.append(fileName) 
     146 
     147        pis = self.client.getAllProviderInfo() 
     148        self.assertEquals(1, len(pis)) 
     149        self.assertEquals(PROVIDER_INFO_1, pis[0]) 
     150 
     151 
     152    def testInvalidGetAllProviderInfo(self): 
     153        pis = self.client.getAllProviderInfo() 
     154        self.assertEquals([], pis) 
     155 
     156 
    143157    def testGetRepositoryInfo(self): 
    144158        pi, fileName = self.client.createProviderInfo(PROVIDER_INFO_2) 
  • TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/tests/dal/testproviderinfodaowithfileclient.py

    r5238 r5240  
    5656        pi = self.dao.getProviderInfo(PROVIDER_INFO_1) 
    5757        self.assertEquals(None, pi) 
     58 
     59 
     60    def testGetAllProviderInfo(self): 
     61        pi, fileName = self.dao.createProviderInfo(PROVIDER_INFO_1) 
     62        self.files.append(fileName) 
     63 
     64        pis = self.dao.getAllProviderInfo() 
     65        self.assertEquals(1, len(pis)) 
     66        self.assertEquals(PROVIDER_INFO_1, pis[0]) 
     67 
     68 
     69    def testInvalidGetAllProviderInfo(self): 
     70        pis = self.dao.getAllProviderInfo() 
     71        self.assertEquals([], pis) 
    5872 
    5973 
Note: See TracChangeset for help on using the changeset viewer.