@Test public void testSetDefault() { config.setDefaultValues(tl); boolean cacheBypass = tl.isCacheBypassAllowed(); int timeout = tl.getBackendTimeout(); assertEquals(cacheBypass, false); assertEquals(timeout, 120); assertNull(tl.getFormatModifiers()); }
/** * NB The following code is shared across Google Maps, Mobile Google Maps and Virtual Earth */ public void handleRequest(ConveyorTile tile) throws GeoWebCacheException { if (tile.getHint() != null) { //boolean requestTiled = true; if (tile.getHint().equals("not_cached,not_metatiled")) { //requestTiled = false; } else if (!tile.getHint().equals("not_cached")) { throw new GeoWebCacheException("Hint " + tile.getHint() + " is not known."); } TileLayer tl = tld.getTileLayer(tile.getLayerId()); if (tl == null) { throw new GeoWebCacheException("Unknown layer " + tile.getLayerId()); } if(! tl.isCacheBypassAllowed().booleanValue()) { throw new GeoWebCacheException("Layer " + tile.getLayerId() + " is not configured to allow bypassing the cache."); } tile.setTileLayer(tl); tl.getNoncachedTile(tile); Service.writeTileResponse(tile, false); } }
/** NB The following code is shared across Google Maps, Mobile Google Maps and Virtual Earth */ public void handleRequest(ConveyorTile tile) throws GeoWebCacheException { if (tile.getHint() != null) { // boolean requestTiled = true; if (!tile.getHint().equals("not_cached,not_metatiled") && !tile.getHint().equals("not_cached")) { throw new GeoWebCacheException("Hint " + tile.getHint() + " is not known."); } TileLayer tl = tld.getTileLayer(tile.getLayerId()); if (tl == null) { throw new GeoWebCacheException("Unknown layer " + tile.getLayerId()); } if (!tl.isCacheBypassAllowed().booleanValue()) { throw new GeoWebCacheException( "Layer " + tile.getLayerId() + " is not configured to allow bypassing the cache."); } tile.setTileLayer(tl); tl.getNoncachedTile(tile); Service.writeTileResponse(tile, false); } }
/** NB The following code is shared across Google Maps, Mobile Google Maps and Virtual Earth */ public void handleRequest(ConveyorTile tile) throws GeoWebCacheException { if (tile.getHint() != null) { // boolean requestTiled = true; if (!tile.getHint().equals("not_cached,not_metatiled") && !tile.getHint().equals("not_cached")) { throw new GeoWebCacheException("Hint " + tile.getHint() + " is not known."); } TileLayer tl = tld.getTileLayer(tile.getLayerId()); if (tl == null) { throw new GeoWebCacheException("Unknown layer " + tile.getLayerId()); } if (!tl.isCacheBypassAllowed().booleanValue()) { throw new GeoWebCacheException( "Layer " + tile.getLayerId() + " is not configured to allow bypassing the cache."); } tile.setTileLayer(tl); tl.getNoncachedTile(tile); Service.writeTileResponse(tile, false); } }
/** NB The following code is shared across Google Maps, Mobile Google Maps and Virtual Earth */ public void handleRequest(ConveyorTile tile) throws GeoWebCacheException { if (tile.getHint() != null) { // boolean requestTiled = true; if (!tile.getHint().equals("not_cached,not_metatiled") && !tile.getHint().equals("not_cached")) { throw new GeoWebCacheException("Hint " + tile.getHint() + " is not known."); } TileLayer tl = tld.getTileLayer(tile.getLayerId()); if (tl == null) { throw new GeoWebCacheException("Unknown layer " + tile.getLayerId()); } if (!tl.isCacheBypassAllowed().booleanValue()) { throw new GeoWebCacheException( "Layer " + tile.getLayerId() + " is not configured to allow bypassing the cache."); } tile.setTileLayer(tl); tl.getNoncachedTile(tile); Service.writeTileResponse(tile, false); } }
/** * NB The following code is shared across Google Maps, Mobile Google Maps and Virtual Earth */ public void handleRequest(ConveyorTile tile) throws GeoWebCacheException { if (tile.getHint() != null) { // boolean requestTiled = true; if (tile.getHint().equals("not_cached,not_metatiled")) { // requestTiled = false; } else if (!tile.getHint().equals("not_cached")) { throw new GeoWebCacheException("Hint " + tile.getHint() + " is not known."); } TileLayer tl = tld.getTileLayer(tile.getLayerId()); if (tl == null) { throw new GeoWebCacheException("Unknown layer " + tile.getLayerId()); } if (!tl.isCacheBypassAllowed().booleanValue()) { throw new GeoWebCacheException("Layer " + tile.getLayerId() + " is not configured to allow bypassing the cache."); } tile.setTileLayer(tl); tl.getNoncachedTile(tile); Service.writeTileResponse(tile, false); } }
/** NB The following code is shared across Google Maps, Mobile Google Maps and Virtual Earth */ public void handleRequest(ConveyorTile tile) throws GeoWebCacheException { if (tile.getHint() != null) { // boolean requestTiled = true; if (tile.getHint().equals("not_cached,not_metatiled")) { // requestTiled = false; } else if (!tile.getHint().equals("not_cached")) { throw new GeoWebCacheException("Hint " + tile.getHint() + " is not known."); } TileLayer tl = tld.getTileLayer(tile.getLayerId()); if (tl == null) { throw new GeoWebCacheException("Unknown layer " + tile.getLayerId()); } if (!tl.isCacheBypassAllowed().booleanValue()) { throw new GeoWebCacheException( "Layer " + tile.getLayerId() + " is not configured to allow bypassing the cache."); } tile.setTileLayer(tl); tl.getNoncachedTile(tile); Service.writeTileResponse(tile, false); } }
@Test public void testLoad101() throws Exception { Iterable<TileLayer> layers = loadResource("geowebcache_101.xml"); TileLayer layer = findLayer(layers, "topp:states"); assertTrue(layer != null); // assertEquals(layer.getCachePrefix(), "/var/lib/geowebcache/topp_states"); TileLayer layer2 = findLayer(layers, "topp:states2"); GridSubset grid = layer2.getGridSubsetForSRS(SRS.getSRS(2163)); assertTrue(layer2 != null); assertTrue(grid != null); // The additions in 1.0.1 are allowCacheBypass and backendTimeout assertEquals(layer.getBackendTimeout().intValue(), 60); assertEquals(layer2.getBackendTimeout().intValue(), 235); assertEquals(layer.isCacheBypassAllowed().booleanValue(), true); assertEquals(layer2.isCacheBypassAllowed().booleanValue(), false); }
@Test public void testUnsetConfigs() { assertNull(tl.isCacheBypassAllowed()); assertNull(tl.getBackendTimeout()); assertNull(tl.getFormatModifiers()); }
public void setDefaultValues(TileLayer layer) { if (layer.isCacheBypassAllowed() == null) { if (getGwcConfig().getCacheBypassAllowed() != null) { layer.setCacheBypassAllowed(getGwcConfig().getCacheBypassAllowed());
@Test public void testLoad115() throws Exception { Iterable<TileLayer> layers = loadResource("geowebcache_115.xml"); TileLayer layer = findLayer(layers, "topp:states"); assertTrue(layer != null); // assertEquals(layer.getCachePrefix(), "/var/lib/geowebcache/topp_states"); TileLayer layer2 = findLayer(layers, "topp:states2"); GridSubset grid = layer2.getGridSubsetForSRS(SRS.getSRS(2163)); assertTrue(layer2 != null); assertTrue(grid != null); // The additions in 1.0.1 are allowCacheBypass and backendTimeout assertEquals(layer.getBackendTimeout().intValue(), 120); assertEquals(layer2.getBackendTimeout().intValue(), 120); assertEquals(layer.isCacheBypassAllowed().booleanValue(), true); assertEquals(layer2.isCacheBypassAllowed().booleanValue(), true); FormatModifier fm = layer.getFormatModifier(ImageMime.jpeg); assertEquals(fm.getBgColor(), "0xDDDDDD"); assertTrue(fm.getRequestFormat().equals(ImageMime.png)); List<RequestFilter> filters = layer.getRequestFilters(); RequestFilter filter0 = filters.get(0); assertEquals(filter0.getName(), "testWMSRasterFilter"); RequestFilter filter1 = filters.get(1); assertEquals(filter1.getName(), "testFileRasterFilter"); }
@Test public void testLoad114() throws Exception { Iterable<TileLayer> layers = loadResource("geowebcache_114.xml"); TileLayer layer = findLayer(layers, "topp:states"); assertTrue(layer != null); // assertEquals(layer.getCachePrefix(), "/var/lib/geowebcache/topp_states"); TileLayer layer2 = findLayer(layers, "topp:states2"); GridSubset grid = layer2.getGridSubsetForSRS(SRS.getSRS(2163)); assertTrue(layer2 != null); assertTrue(grid != null); // The additions in 1.0.1 are allowCacheBypass and backendTimeout assertEquals(layer.getBackendTimeout().intValue(), 120); assertEquals(layer2.getBackendTimeout().intValue(), 120); assertEquals(layer.isCacheBypassAllowed().booleanValue(), true); assertEquals(layer2.isCacheBypassAllowed().booleanValue(), true); FormatModifier fm = layer.getFormatModifier(ImageMime.jpeg); assertEquals(fm.getBgColor(), "0xDDDDDD"); assertTrue(fm.getRequestFormat().equals(ImageMime.png)); List<RequestFilter> filters = layer.getRequestFilters(); assertEquals(filters.get(0).getName(), "testWMSRasterFilter"); assertEquals(filters.get(1).getName(), "testFileRasterFilter"); }
@Override public void setDefaultValues(TileLayer layer) { if (layer.isCacheBypassAllowed() == null) { if (getGwcConfig().getCacheBypassAllowed() != null) { layer.setCacheBypassAllowed(getGwcConfig().getCacheBypassAllowed());