def getRequests(self, name):
     if DataCache.isRequestDataExpired():
         DataCache.setRequestData(getRequestOverview(self.serviceURL, self.serviceLevel))
     prog = re.compile(name, re.IGNORECASE)
     filtered = []
     for item in DataCache.getRequestData():
         if prog.search(item['request_name']) != None:
             filtered.append(item)
     return filtered
Beispiel #2
0
 def getRequests(self, name):
     if DataCache.isRequestDataExpired():
         DataCache.setRequestData(
             getRequestOverview(self.serviceURL, self.serviceLevel))
     prog = re.compile(name, re.IGNORECASE)
     filtered = []
     for item in DataCache.getRequestData():
         if prog.search(item['request_name']) != None:
             filtered.append(item)
     return filtered
Beispiel #3
0
 def setUp(self):
     self.dataCache = DataCache()
Beispiel #4
0
class DataCacheTest(unittest.TestCase):
    def setUp(self):
        self.dataCache = DataCache()

    def testDataCache(self):
        agentData = ['agentData1']
        self.dataCache.setAgentData(agentData)
        self.assertEqual(self.dataCache.isAgentDataExpired(), False)
        self.assertEqual(self.dataCache.getAgentData(), agentData)

        requestData = ['requestData1']
        self.dataCache.setRequestData(requestData)
        self.assertEqual(self.dataCache.isRequestDataExpired(), False)
        self.assertEqual(self.dataCache.getRequestData(), requestData)

        siteData = ['siteData1']
        self.dataCache.setSiteData(siteData)
        self.assertEqual(self.dataCache.isSiteDataExpired(), False)
        self.assertEqual(self.dataCache.getSiteData(), siteData)

        self.dataCache.setDuration(-1)
        self.assertEqual(self.dataCache.isAgentDataExpired(), True)
        self.assertEqual(self.dataCache.isRequestDataExpired(), True)
        self.assertEqual(self.dataCache.isSiteDataExpired(), True)
 def getSiteMonitor(self):
     if DataCache.isSiteDataExpired():
         DataCache.setSiteData(getSiteOverview(self.serviceURL, self.serviceLevel))
     return DataCache.getSiteData()
 def getAgentMonitor(self):
     if DataCache.isAgentDataExpired():
         DataCache.setAgentData(getAgentOverview(self.serviceURL, self.serviceLevel))
     return DataCache.getAgentData()
Beispiel #7
0
 def setUp(self):
     self.dataCache = DataCache()
Beispiel #8
0
class DataCacheTest(unittest.TestCase):

    def setUp(self):
        self.dataCache = DataCache()

    def testDataCache(self):
        agentData = ['agentData1']
        self.dataCache.setAgentData(agentData)
        self.assertEqual(self.dataCache.isAgentDataExpired(), False)
        self.assertEqual(self.dataCache.getAgentData(), agentData)

        requestData = ['requestData1']
        self.dataCache.setRequestData(requestData)
        self.assertEqual(self.dataCache.isRequestDataExpired(), False)
        self.assertEqual(self.dataCache.getRequestData(), requestData)

        siteData = ['siteData1']
        self.dataCache.setSiteData(siteData)
        self.assertEqual(self.dataCache.isSiteDataExpired(), False)
        self.assertEqual(self.dataCache.getSiteData(), siteData)

        self.dataCache.setDuration(-1)
        self.assertEqual(self.dataCache.isAgentDataExpired(), True)
        self.assertEqual(self.dataCache.isRequestDataExpired(), True)
        self.assertEqual(self.dataCache.isSiteDataExpired(), True)
Beispiel #9
0
 def getSiteMonitor(self):
     if DataCache.isSiteDataExpired():
         DataCache.setSiteData(
             getSiteOverview(self.serviceURL, self.serviceLevel))
     return DataCache.getSiteData()
Beispiel #10
0
 def getAgentMonitor(self):
     if DataCache.isAgentDataExpired():
         DataCache.setAgentData(
             getAgentOverview(self.serviceURL, self.serviceLevel))
     return DataCache.getAgentData()