Esempio n. 1
0
    def test_set_cache(self):
        self.assertThereIsNoInstanceOf(PersistentCache)

        PersistentCache.set_cache('some-cache', 'some data')
        self._assert_persistent_cache('some-cache', 'some data')

        PersistentCache.set_cache('some-cache', 'some other data')

        self._assert_persistent_cache('some-cache', 'some other data')
Esempio n. 2
0
    def test_set_cache(self):
        self.assertThereIsNoInstanceOf(PersistentCache)

        PersistentCache.set_cache('some-cache', 'some data')
        self._assert_persistent_cache('some-cache', 'some data')

        PersistentCache.set_cache('some-cache', 'some other data')

        self._assert_persistent_cache('some-cache', 'some other data')
Esempio n. 3
0
    def test_get_cache(self):
        self.assertEqual(memcache.get('some-cache'), None)
        self.assertEqual(PersistentCache.get_cache('some-cache'), None)

        PersistentCache.set_cache('some-cache', 'some data')

        self.assertEqual(memcache.get('some-cache'), 'some data')
        self.assertEqual(PersistentCache.get_cache('some-cache'), 'some data')

        memcache.delete('some-cache')
        self.assertEqual(memcache.get('some-cache'), None)
        self.assertEqual(PersistentCache.get_cache('some-cache'), 'some data')
Esempio n. 4
0
    def test_get_cache(self):
        self.assertEqual(memcache.get('some-cache'), None)
        self.assertEqual(PersistentCache.get_cache('some-cache'), None)

        PersistentCache.set_cache('some-cache', 'some data')

        self.assertEqual(memcache.get('some-cache'), 'some data')
        self.assertEqual(PersistentCache.get_cache('some-cache'), 'some data')

        memcache.delete('some-cache')
        self.assertEqual(memcache.get('some-cache'), None)
        self.assertEqual(PersistentCache.get_cache('some-cache'), 'some data')
Esempio n. 5
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
        test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)

        branch = model_from_numeric_id(branch_id, Branch)
        platform = model_from_numeric_id(platform_id, Platform)
        test = model_from_numeric_id(test_id, Test)
        assert branch
        assert platform
        assert test

        PersistentCache.set_cache(Test.cache_key(test_id, branch_id, platform_id), Runs(branch, platform, test.name).to_json())
        self.response.out.write('OK')
Esempio n. 6
0
 def get(self):
     self.response.headers["Content-Type"] = "application/json"
     manifest = PersistentCache.get_cache("manifest")
     if manifest:
         self.response.out.write(manifest)
     else:
         schedule_manifest_update()
Esempio n. 7
0
 def get(self):
     self.response.headers['Content-Type'] = 'application/json'
     dashboard = PersistentCache.get_cache('dashboard')
     if dashboard:
         self.response.out.write(dashboard)
     else:
         schedule_dashboard_update()
Esempio n. 8
0
 def get(self):
     self.response.headers["Content-Type"] = "application/json"
     dashboard = PersistentCache.get_cache("dashboard")
     if dashboard:
         self.response.out.write(dashboard)
     else:
         schedule_dashboard_update()
Esempio n. 9
0
 def get(self):
     self.response.headers['Content-Type'] = 'application/json'
     dashboard = PersistentCache.get_cache('dashboard')
     if dashboard:
         self.response.out.write(dashboard)
     else:
         schedule_dashboard_update()
Esempio n. 10
0
 def get(self):
     self.response.headers['Content-Type'] = 'application/json'
     manifest = PersistentCache.get_cache('manifest')
     if manifest:
         self.response.out.write(manifest)
     else:
         schedule_manifest_update()
Esempio n. 11
0
 def get(self):
     self.response.headers['Content-Type'] = 'application/json'
     manifest = PersistentCache.get_cache('manifest')
     if manifest:
         self.response.out.write(manifest)
     else:
         schedule_manifest_update()
Esempio n. 12
0
    def get(self):
        self.response.headers['Content-Type'] = 'application/json'

        test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)
        runs = PersistentCache.get_cache(Test.cache_key(test_id, branch_id, platform_id))
        if runs:
            self.response.out.write(runs)
        else:
            schedule_runs_update(test_id, branch_id, platform_id)
Esempio n. 13
0
    def get(self):
        self.response.headers['Content-Type'] = 'application/json'

        try:
            test_id = int(self.request.get('id', 0))
            branch_id = int(self.request.get('branchid', 0))
            platform_id = int(self.request.get('platformid', 0))
        except TypeError:
            # FIXME: Output an error here
            test_id = 0
            branch_id = 0
            platform_id = 0

        runs = PersistentCache.get_cache(Test.cache_key(test_id, branch_id, platform_id))
        if runs:
            self.response.out.write(runs)
        else:
            schedule_runs_update(test_id, branch_id, platform_id)
Esempio n. 14
0
 def _assert_persistent_cache(self, name, value):
     self.assertEqual(PersistentCache.get_by_key_name(name).value, value)
     self.assertEqual(memcache.get(name), value)
Esempio n. 15
0
 def post(self):
     self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
     PersistentCache.set_cache('dashboard',
                               DashboardJSONGenerator().to_json())
     self.response.out.write('OK')
Esempio n. 16
0
 def post(self):
     self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
     PersistentCache.set_cache('dashboard', DashboardJSONGenerator().to_json())
     self.response.out.write('OK')
Esempio n. 17
0
 def post(self):
     self.response.headers["Content-Type"] = "text/plain; charset=utf-8"
     PersistentCache.set_cache("dashboard", DashboardJSONGenerator().to_json())
     self.response.out.write("OK")
Esempio n. 18
0
def cache_manifest(cache):
    PersistentCache.set_cache('manifest', cache)
Esempio n. 19
0
def cache_dashboard(cache):
    PersistentCache.set_cache('dashboard', cache)
Esempio n. 20
0
 def _assert_persistent_cache(self, name, value):
     self.assertEqual(PersistentCache.get_by_key_name(name).value, value)
     self.assertEqual(memcache.get(name), value)
Esempio n. 21
0
def cache_runs(test_id, branch_id, platform_id, cache):
    PersistentCache.set_cache(Test.cache_key(test_id, branch_id, platform_id), cache)