Exemplo n.º 1
0
class RiakCacheTestBase(TileCacheTestBase):
    always_loads_metadata = True
    def setup(self):
        if not os.environ.get(self.riak_url_env):
            raise SkipTest()

        url = os.environ[self.riak_url_env]
        urlparts = urlparse.urlparse(url)
        protocol = urlparts.scheme.lower()
        node = {'host': urlparts.hostname}
        if ':' in urlparts.hostname:
            if protocol == 'pbc':
                node['pb_port'] = urlparts.port
            if protocol in ('http', 'https'):
                node['http_port'] = urlparts.port

        db_name = 'mapproxy_test_%d' % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        self.cache = RiakCache([node], protocol, db_name, tile_grid=tile_grid(3857, name='global-webmarcator'))

    def teardown(self):
        import riak
        bucket = self.cache.bucket
        for k in bucket.get_keys():
            riak.RiakObject(self.cache.connection, bucket, k).delete()
        TileCacheTestBase.teardown(self)

    def test_double_remove(self):
        tile = self.create_tile()
        self.create_cached_tile(tile)
        assert self.cache.remove_tile(tile)
        assert self.cache.remove_tile(tile)
Exemplo n.º 2
0
    def setup(self):
        url = os.environ[self.riak_url_env]
        urlparts = urlparse.urlparse(url)
        protocol = urlparts.scheme.lower()
        node = {'host': urlparts.hostname}
        if ':' in urlparts.hostname:
            if protocol == 'pbc':
                node['pb_port'] = urlparts.port
            if protocol in ('http', 'https'):
                node['http_port'] = urlparts.port

        db_name = 'mapproxy_test_%d' % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        self.cache = RiakCache([node], protocol, db_name, tile_grid=tile_grid(3857, name='global-webmarcator'))
Exemplo n.º 3
0
class RiakCacheTestBase(TileCacheTestBase):
    always_loads_metadata = True
    def setup(self):
        if not os.environ.get(self.riak_url_env):
            raise SkipTest()

        url = os.environ[self.riak_url_env]
        urlparts = urlparse.urlparse(url)
        protocol = urlparts.scheme.lower()
        node = {'host': urlparts.hostname}
        if ':' in urlparts.hostname:
            if protocol == 'pbc':
                node['pb_port'] = urlparts.port
            if protocol in ('http', 'https'):
                node['http_port'] = urlparts.port

        db_name = 'mapproxy_test_%d' % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        self.cache = RiakCache([node], protocol, db_name, tile_grid=tile_grid(3857, name='global-webmarcator'))

    def teardown(self):
        import riak
        bucket = self.cache.bucket
        for k in bucket.get_keys():
            riak.RiakObject(self.cache.connection, bucket, k).delete()
        TileCacheTestBase.teardown(self)

    def test_double_remove(self):
        tile = self.create_tile()
        self.create_cached_tile(tile)
        assert self.cache.remove_tile(tile)
        assert self.cache.remove_tile(tile)
Exemplo n.º 4
0
class RiakCacheTestBase(TileCacheTestBase):
    always_loads_metadata = True

    def setup(self):
        if not os.environ.get(self.riak_url_env):
            raise SkipTest()

        riak_url = os.environ[self.riak_url_env]
        db_name = "mapproxy_test_%d" % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        self.cache = RiakCache(
            riak_url, db_name, "riak", tile_grid=tile_grid(3857, name="global-webmarcator"), lock_dir=self.cache_dir
        )

    def teardown(self):
        import riak

        bucket = self.cache.bucket
        for k in bucket.get_keys():
            riak.RiakObject(self.cache.connection, bucket, k).delete()
        TileCacheTestBase.teardown(self)

    def test_double_remove(self):
        tile = self.create_tile()
        self.create_cached_tile(tile)
        assert self.cache.remove_tile(tile)
        assert self.cache.remove_tile(tile)
Exemplo n.º 5
0
    def setup(self):
        if not os.environ.get(self.riak_url_env):
            raise SkipTest()

        riak_url = os.environ[self.riak_url_env]
        db_name = "mapproxy_test_%d" % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        self.cache = RiakCache(
            riak_url, db_name, "riak", tile_grid=tile_grid(3857, name="global-webmarcator"), lock_dir=self.cache_dir
        )
Exemplo n.º 6
0
    def setup(self):
        if not os.environ.get(self.riak_url_env):
            raise SkipTest()

        url = os.environ[self.riak_url_env]
        urlparts = urlparse.urlparse(url)
        protocol = urlparts.scheme.lower()
        node = {'host': urlparts.hostname}
        if ':' in urlparts.hostname:
            if protocol == 'pbc':
                node['pb_port'] = urlparts.port
            if protocol in ('http', 'https'):
                node['http_port'] = urlparts.port

        db_name = 'mapproxy_test_%d' % random.randint(0, 100000)

        TileCacheTestBase.setup(self)

        self.cache = RiakCache([node], protocol, db_name, tile_grid=tile_grid(3857, name='global-webmarcator'))