Package org.geomajas.plugin.caching.service

Examples of org.geomajas.plugin.caching.service.DummyCacheService


    Assert.assertEquals("<g id=\"beans.features.1-0-1\"/>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // verify that data is in the cache
    DummyCacheService cache = (DummyCacheService) cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.TILE);
    Assert.assertEquals(1, cache.size());
    TileCacheContainer tcc = (TileCacheContainer) cache.getObject();
    tcc.getTile().setFeatureContent("<dummy />");

    // get tile again, the result should be different because we changed the cached value
    recorder.clear();
    tile = vectorLayerService.getTile(tmd);
View Full Code Here


    Assert.assertEquals("<g id=\"beans.features.1-0-1\"/>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // verify that data is in the cache
    DummyCacheService cache = (DummyCacheService)cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.TILE);
    Assert.assertEquals(1, cache.size());
    cache.clear(); // remove tile from cache

    // get tile again, should put tile in cache again but use features and string from cache
    recorder.clear();
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
View Full Code Here

        tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // verify that data is in the cache
    DummyCacheService cache = (DummyCacheService)cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.TILE);
    Assert.assertEquals(1, cache.size());
    cache.clear(); // remove tile from cache

    cache = (DummyCacheService) cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.FEATURE);
    Assert.assertEquals(1, cache.size());
    FeaturesCacheContainer fcc = (FeaturesCacheContainer) cache.getObject();
    List<InternalFeature> features = fcc.getFeatures();
    Assert.assertEquals(3, features.size());
    InternalFeature feature = features.get(2);
    Assert.assertEquals(2, feature.getGeometry().getCoordinates()[0].x, DELTA);
    Assert.assertEquals(1, feature.getGeometry().getCoordinates()[0].y, DELTA);

    // get tile again, should put tile in cache again but use features and string from cache
    recorder.clear();
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
    Assert.assertEquals(
        "<g id=\"beans.features.1-1-1\"><g style=\"fill:#995500;fill-opacity:0.6;stroke:#995500;" +
            "stroke-opacity:0.3;stroke-width:1px;\" id=\"beans.features.1-1-1.0\">" +
            "<path fill-rule=\"evenodd\" d=\"M445278 0l0 -334111 222639 0 0 334111 -222639 0 Z\" " +
            "id=\"2\"></path><path fill-rule=\"evenodd\" " +
            "d=\"M222639 -111325l0 -111359 556597 0 -111319 111359 -445278 0 Z\" id=\"3\"/></g></g>",
        tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Got item from cache"));

    cache = (DummyCacheService) cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.FEATURE);
    Assert.assertEquals(1, cache.size());
    fcc = (FeaturesCacheContainer) cache.getObject();
    features = fcc.getFeatures();
    Assert.assertEquals(3, features.size());
    feature = features.get(2);
    Assert.assertEquals(2, feature.getGeometry().getCoordinates()[0].x, DELTA);
    Assert.assertEquals(1, feature.getGeometry().getCoordinates()[0].y, DELTA);
View Full Code Here

    Assert.assertEquals(3.0, bounds.getMaxY(), DELTA);
    Assert.assertEquals("", recorder.matches(CacheCategory.BOUNDS,
        "Put item in cache"));

    // verify that data is in the cache
    DummyCacheService cache = (DummyCacheService)cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.BOUNDS);
    Assert.assertEquals(1, cache.size());
    String key = cache.getKey();
    BoundsCacheContainer bcc = (BoundsCacheContainer) cache.getObject();
    CacheContext cc = bcc.getContext();
    bcc = new BoundsCacheContainer(new Envelope(0, 10, 0, 10));
    bcc.setContext(cc);
    cache.put(key, bcc);

    // get bounds again, the result should be different because we changed the cached value
    recorder.clear();
    bounds = vectorLayerService.getBounds(LAYER_BEANS, geoService.getCrs2("EPSG:4326"), null);
    Assert.assertNotNull(bounds);
View Full Code Here

    Assert.assertEquals(3, features.size());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE,
        "Put item in cache"));

    // verify that data is in the cache
    DummyCacheService cache = (DummyCacheService)cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.FEATURE);
    Assert.assertEquals(1, cache.size());
    FeaturesCacheContainer bcc = (FeaturesCacheContainer) cache.getObject();
    bcc.getFeatures().remove(2);

    // get features again, the result should be different because we changed the cached value
    recorder.clear();
    features = vectorLayerService.getFeatures(LAYER_BEANS, wgs84, null, null,
View Full Code Here

TOP

Related Classes of org.geomajas.plugin.caching.service.DummyCacheService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.