Package org.geowebcache.diskquota.storage

Examples of org.geowebcache.diskquota.storage.TileSet


    }

    public void testDeleteGridSet() throws InterruptedException {
        // put some data into the two gridsets
        String layerName = "topp:states";
        TileSet tset1 = new TileSet(layerName, "EPSG:4326", "image/jpeg", null);
        addToQuotaStore(tset1);
        TileSet tset2 = new TileSet(layerName, "EPSG:900913", "image/jpeg", null);
        addToQuotaStore(tset2);
        Quota tset1Quota = store.getUsedQuotaByTileSetId(tset1.getId());
        Quota tset2Quota = store.getUsedQuotaByTileSetId(tset2.getId());
        Quota globalQuota = store.getGloballyUsedQuota();
        Quota sum = new Quota();
        sum.add(tset1Quota);
        sum.add(tset2Quota);
        assertEquals(globalQuota.getBytes(), sum.getBytes());
       
        assertEquals(8, countTileSetsByLayerName("topp:states"));
        store.deleteGridSubset("topp:states", "EPSG:900913");
        assertEquals(4, countTileSetsByLayerName("topp:states"));

        // verify the quota for tset2 got erased and that now the total is equal to tset1
        tset1Quota = store.getUsedQuotaByTileSetId(tset1.getId());
        tset2Quota = store.getUsedQuotaByTileSetId(tset2.getId());
        globalQuota = store.getGloballyUsedQuota();
        assertNull(tset2Quota);
        assertEquals(tset1Quota.getBytes(), globalQuota.getBytes());
    }
View Full Code Here


    }

    public void testDeleteLayer() throws InterruptedException {
        // put some data into the layer
        String layerName = "topp:states2";
        TileSet tset = new TileSet(layerName, "EPSG:2163", "image/jpeg", null);

        addToQuotaStore(tset);

        // make sure the layer is there and has stuff
        Quota oldUsedQuota = store.getUsedQuotaByLayerName(layerName);
        assertNotNull(oldUsedQuota);
        Quota globalQuotaBefore = store.getGloballyUsedQuota();
        assertTrue(oldUsedQuota.getBytes().longValue() > 0);
        assertTrue(globalQuotaBefore.getBytes().longValue() > 0);

        TileSet tileSet = tilePageCalculator.getTileSetsFor(layerName).iterator().next();
        TilePage page = new TilePage(tileSet.getId(), 0, 0, (byte) 0);
        store.addHitsAndSetAccesTime(Collections.singleton(new PageStatsPayload(page)));

        assertNotNull(store.getTileSetById(tileSet.getId()));

        store.deleteLayer(layerName);

        // cascade deleted?
        assertNull(store.getLeastRecentlyUsedPage(Collections.singleton(layerName)));
View Full Code Here

        });
        assertEquals(tileSets1, tileSets2);
    }

    public void testGetTileSetById() throws Exception {
        TileSet tileSet = store.getTileSetById(testTileSet.getId());
        assertNotNull(tileSet);
        assertEquals(testTileSet, tileSet);

        try {
            store.getTileSetById("NonExistentTileSetId");
View Full Code Here

    @SuppressWarnings("unchecked")
    public void testUpdateUsedQuotaWithParameters() throws Exception {
        // prepare a tileset with params
        String paramId = DigestUtils.shaHex("&styles=polygon");
        TileSet tset = new TileSet("topp:states2", "EPSG:2163", "image/jpeg", paramId);

        Quota quotaDiff = new Quota(10D * Math.random(), StorageUnit.MiB);
        PageStatsPayload stats = new PageStatsPayload(new TilePage(tset.getId(), 0, 0, 3));
        stats.setNumTiles(10);
        store.addToQuotaAndTileCounts(tset, quotaDiff, Collections.singletonList(stats));

        assertEquals(quotaDiff.getBytes(), store.getUsedQuotaByTileSetId(tset.getId()).getBytes());
    }
View Full Code Here

        final MockSystemUtils sysUtils = new MockSystemUtils();
        sysUtils.setCurrentTimeMinutes(10);
        sysUtils.setCurrentTimeMillis(10 * 60 * 1000);
        SystemUtils.set(sysUtils);

        TileSet tileSet = testTileSet;

        TilePage page = new TilePage(tileSet.getId(), 0, 0, (byte) 0);

        PageStatsPayload payload = new PageStatsPayload(page);
        int numHits = 100;
        payload.setTileSet(tileSet);
        payload.setLastAccessTime(sysUtils.currentTimeMillis() - 1 * 60 * 1000);
 
View Full Code Here

        Quota usedQuota = store.getGloballyUsedQuota();
        assertNotNull(usedQuota);
        assertEquals(0, usedQuota.getBytes().intValue());

        String layerName = tilePageCalculator.getLayerNames().iterator().next();
        TileSet tileSet = tilePageCalculator.getTileSetsFor(layerName).iterator().next();

        Quota quotaDiff = new Quota(BigInteger.valueOf(1000));
        Collection<PageStatsPayload> tileCountDiffs = Collections.emptySet();
        store.addToQuotaAndTileCounts(tileSet, quotaDiff, tileCountDiffs);
View Full Code Here

        }
    }

    private void expirePage(QuotaStore pageStore, TilePage tilePage) throws InterruptedException {
        final String tileSetId = tilePage.getTileSetId();
        final TileSet tileSet = pageStore.getTileSetById(tileSetId);
        final String layerName = tileSet.getLayerName();
        final String gridSetId = tileSet.getGridsetId();
        final String blobFormat = tileSet.getBlobFormat();
        final String parametersId = tileSet.getParametersId();
        final int zoomLevel = tilePage.getZoomLevel();
        final long[][] pageGridCoverage = pageStore.getTilesForPage(tilePage);

        MimeType mimeType;
        try {
View Full Code Here

                final String blobFormat = null;
                String parametersId = null;
                if (parts.length == 2) {
                    parametersId = parts[1];
                }
                TileSet tileSet = new TileSet(layerName, gridsetId, blobFormat, parametersId);
                foundTileSets.add(tileSet);
            }
        }
        return foundTileSets;
    }
View Full Code Here

     * @throws InterruptedException
     */
    private void performAggregatedUpdate(final UsageStats requestedTile)
            throws InterruptedException {

        final TileSet tileSet = requestedTile.getTileSet();
        final String tileSetId = tileSet.getId();
        final long[] tileIndex = requestedTile.getTileIndex();

        tilePageCalculator.pageIndexForTile(tileSet, tileIndex, pageIndexTarget);
        final int pageX = pageIndexTarget[0];
        final int pageY = pageIndexTarget[1];
View Full Code Here

     *            value decreases it
     * @param tileIdex
     */
    public QuotaUpdate(String layerName, String gridsetId, String blobFormat, String parametersId,
            long size, long[] tileIndex) {
        this(new TileSet(layerName, gridsetId, blobFormat, parametersId), size, tileIndex);
    }
View Full Code Here

TOP

Related Classes of org.geowebcache.diskquota.storage.TileSet

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.