Examples of TileObject


Examples of org.geowebcache.storage.TileObject

        boolean tryCache = false;
        layer.seedTile(tile, tryCache);

        assertEquals(1, captured.getValues().size());
        TileObject value = captured.getValue();
        assertNotNull(value);
        assertEquals("image/png", value.getBlobFormat());
        assertNotNull(value.getBlob());
        assertTrue(value.getBlob().getSize() > 0);

        verify(mockStorageBroker);
    }
View Full Code Here

Examples of org.geowebcache.storage.TileObject

                    }

                    if (store) {
                        long[] idx = { gridPos[0], gridPos[1], gridPos[2] };

                        TileObject tile = TileObject.createCompleteTileObject(this.getName(), idx,
                                tileProto.getGridSetId(), tileProto.getMimeType().getFormat(),
                                tileProto.getParameters(), resource);

                        try {
                            tileProto.getStorageBroker().put(tile);
View Full Code Here

Examples of org.geowebcache.storage.TileObject

                + " tiles/s)");
    }

    private long insertTiles(final long numTiles, final int offset) throws Exception {
        long[] xyz;
        TileObject tileObject;
        long totalTime = 0;
        for (int i = 0; i < numTiles; i++) {
            xyz = new long[] { i + offset, i + offset, 0 };
            tileObject = TileObject.createCompleteTileObject(layerName, xyz, gridSetId, format,
                    parameters, blob);
View Full Code Here

Examples of org.geowebcache.storage.TileObject

                    continue;
                }

                // System.out.println("x: " + xyz[0] + " y: " + xyz[1] + " z: " + xyz[2]);

                TileObject to = TileObject.createQueryTileObject(trObj.layerName, xyz,
                        trObj.gridSetId, trObj.mimeType.getFormat(), trObj.parameters);
                to.setParamtersId(parametersId);

                try {
                    blobStore.delete(to);
                } catch (StorageException e) {
                    log.debug("Error while deleting range: " + e.getMessage());
View Full Code Here

Examples of org.geowebcache.storage.TileObject

                        log.error("metaTile.writeTileToStream returned false, no tiles saved");
                    }
                    if (store) {
                        long[] idx = { gridPos[0], gridPos[1], gridPos[2] };

                        TileObject tile = TileObject.createCompleteTileObject(this.getName(), idx,
                                tileProto.getGridSetId(), tileProto.getMimeType().getFormat(),
                                tileProto.getParameters(), resource);
                        tile.setCreated(requestTime);

                        try {
                            if (tileProto.isMetaTileCacheOnly()) {
                                tileProto.getStorageBroker().putTransient(tile);
                            } else {
                                tileProto.getStorageBroker().put(tile);
                            }
                            tileProto.getStorageObject().setCreated(tile.getCreated());
                        } catch (StorageException e) {
                            throw new GeoWebCacheException(e);
                        }
                    }
                } catch (IOException ioe) {
View Full Code Here

Examples of org.geowebcache.storage.TileObject

        generator = new FilePathGenerator(testRoot.getPath());
        collisionGenerator = new FilePathGenerator(testRoot.getPath());
    }

    public void testPathNoParams() throws Exception {
        TileObject tile = TileObject.createCompleteTileObject("states", new long[] {0, 0, 0}, "EPSG:2163", "png", null, null);
        File path = generator.tilePath(tile, ImageMime.png);
       
        File expected = new File(testRoot, "states/EPSG_2163_00/0_0/00_00.png");
        assertEquals(expected, path);
    }
View Full Code Here

Examples of org.geowebcache.storage.TileObject

    }
   
    public void testPathWithParams() throws Exception {
        Map<String, String> params = new HashMap<String, String>();
        params.put("style", "population");
        TileObject tile = TileObject.createCompleteTileObject("states", new long[] {0, 0, 0}, "EPSG:2163", "png", params, null);
        String sha1 = DigestUtils.shaHex("?style=population");
       

        // first time, this will also create the path on disk
        File path = generator.tilePath(tile, ImageMime.png);
View Full Code Here

Examples of org.geowebcache.storage.TileObject

            do {
                long[] coverage = gridSubset.getCoverage(level);// {minx,miny,maxx,maxy,z}
                long x = (long) (coverage[0] + ((coverage[2] - coverage[0]) * Math.random()));
                long y = (long) (coverage[1] + ((coverage[3] - coverage[1]) * Math.random()));
                tileIndex = new long[] { x, y, level };
                TileObject tile = TileObject.createCompleteTileObject(layerName, tileIndex, gridSetId, format, null, null);
                tilePath = pathGenerator.tilePath(tile, mimeType);
                tileKey = tilePath.getAbsolutePath();
            } while (addedTiles.contains(tileKey));
            addedTiles.add(tileKey);

View Full Code Here

Examples of org.geowebcache.storage.TileObject

        boolean tryCache = false;
        layer.seedTile(tile, tryCache);

        assertEquals(1, captured.getValues().size());
        TileObject value = captured.getValue();
        assertNotNull(value);
        assertEquals("image/png", value.getBlobFormat());
        assertNotNull(value.getBlob());
        assertTrue(value.getBlob().getSize() > 0);

        verify(mockStorageBroker);
       
        // check the lock provider was called in a symmetric way
        lockProvider.verify();
View Full Code Here

Examples of org.geowebcache.storage.TileObject

        private void installMockBroker() throws Exception {
            expect(storageBroker.getTransient((TileObject) anyObject())).andAnswer(new IAnswer<Boolean>() {

                public Boolean answer() throws Throwable {
                    TileObject tile = (TileObject) EasyMock.getCurrentArguments()[0];
                    String key = TransientCache.computeTransientKey(tile);
                    Resource resource;
                    synchronized (transientCache) {
                        resource = transientCache.get(key);
                    }
                    if (resource != null) {
                        cacheHits.incrementAndGet();
                    } else {
                        cacheMisses.incrementAndGet();
                    }
                    tile.setBlob(resource);
                    return resource != null;
                }
            }).anyTimes();

            storageBroker.putTransient(capture(new Capture<TileObject>() {

                @Override
                public void setValue(TileObject tile) {
                    String key = TransientCache.computeTransientKey(tile);
                    synchronized (transientCache) {
                        transientCache.put(key, tile.getBlob());
                    }
                }
            }));
            expectLastCall().anyTimes();

            final HashSet<String> puts = new HashSet<String>();
            expect(storageBroker.put(capture(new Capture<TileObject>() {
                @Override
                public void setValue(TileObject value) {
                    puts.add(TransientCache.computeTransientKey(value));
                    storagePutCounter.incrementAndGet();
                }
            }))).andReturn(true).anyTimes();
            expect(storageBroker.get((TileObject) anyObject())).andAnswer(new IAnswer<Boolean>() {
                public Boolean answer() throws Throwable {
                    TileObject tile = (TileObject) EasyMock.getCurrentArguments()[0];
                    if (puts.contains(TransientCache.computeTransientKey(tile))) {
                        tile.setBlob(new ByteArrayResource(fakeWMSResponse));
                        storageGetCounter.incrementAndGet();
                        return true;
                    } else {
                        return false;
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.