@Override public GWCConfig clone() { GWCConfig clone; try { clone = (GWCConfig) super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } clone.setDefaultCachingGridSetIds(getDefaultCachingGridSetIds()); clone.setDefaultCoverageCacheFormats(getDefaultCoverageCacheFormats()); clone.setDefaultVectorCacheFormats(getDefaultVectorCacheFormats()); clone.setDefaultOtherCacheFormats(getDefaultOtherCacheFormats()); return clone; }
@Override public GWCConfig clone() { GWCConfig clone; try { clone = (GWCConfig) super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } clone.setDefaultCachingGridSetIds(getDefaultCachingGridSetIds()); clone.setDefaultCoverageCacheFormats(getDefaultCoverageCacheFormats()); clone.setDefaultVectorCacheFormats(getDefaultVectorCacheFormats()); clone.setDefaultOtherCacheFormats(getDefaultOtherCacheFormats()); clone.setCacheConfigurations(getCacheConfigurations()); return clone; }
public void testCreateLayerGroupInfo() { LayerGroupInfoImpl group = mockGroup("testGroup", mockLayer("testLayer",new String[]{}, LayerInfoImpl.Type.RASTER)); defaults.getDefaultOtherCacheFormats().clear(); defaults.getDefaultOtherCacheFormats().add("image/png8"); defaults.getDefaultOtherCacheFormats().add("image/jpeg"); GeoServerTileLayerInfo expected = TileLayerInfoUtil.create(defaults); expected.setId(group.getId()); expected.setName(GWC.tileLayerName(group)); GeoServerTileLayerInfo info = TileLayerInfoUtil.loadOrCreate(group, defaults); assertNotNull(info); assertEquals(expected, info); }
public void testGetMimeTypes() throws Exception { layerInfoTileLayer = new GeoServerTileLayer(layerInfo, defaults, gridSetBroker); List<MimeType> mimeTypes = layerInfoTileLayer.getMimeTypes(); assertEquals(defaults.getDefaultOtherCacheFormats().size(), mimeTypes.size()); layerInfoTileLayer.getInfo().getMimeFormats().clear(); layerInfoTileLayer.getInfo().getMimeFormats().add("image/gif"); mimeTypes = layerInfoTileLayer.getMimeTypes(); assertEquals(1, mimeTypes.size()); assertEquals(MimeType.createFromFormat("image/gif"), mimeTypes.get(0)); }
/** * Creates a default tile layer info based on the global defaults, public only for unit testing * purposes. */ public static GeoServerTileLayerInfoImpl create(GWCConfig defaults) { GeoServerTileLayerInfoImpl info = new GeoServerTileLayerInfoImpl(); info.setEnabled(defaults.isCacheLayersByDefault()); info.setAutoCacheStyles(defaults.isCacheNonDefaultStyles()); for (String gsetId : defaults.getDefaultCachingGridSetIds()) { XMLGridSubset subset = new XMLGridSubset(); subset.setGridSetName(gsetId); info.getGridSubsets().add(subset); } info.getMimeFormats().addAll(defaults.getDefaultOtherCacheFormats()); info.setGutter(defaults.getGutter()); info.setMetaTilingX(defaults.getMetaTilingX()); info.setMetaTilingY(defaults.getMetaTilingY()); return info; }
/** * Creates a default tile layer info based on the global defaults, public only for unit testing * purposes. */ public static GeoServerTileLayerInfoImpl create(GWCConfig defaults) { GeoServerTileLayerInfoImpl info = new GeoServerTileLayerInfoImpl(); info.setEnabled(defaults.isCacheLayersByDefault()); info.setAutoCacheStyles(defaults.isCacheNonDefaultStyles()); for (String gsetId : defaults.getDefaultCachingGridSetIds()) { XMLGridSubset subset = new XMLGridSubset(); subset.setGridSetName(gsetId); info.getGridSubsets().add(subset); } info.getMimeFormats().addAll(defaults.getDefaultOtherCacheFormats()); info.setGutter(defaults.getGutter()); info.setMetaTilingX(defaults.getMetaTilingX()); info.setMetaTilingY(defaults.getMetaTilingY()); info.setInMemoryCached(true); return info; }
public void testClone() { GWCConfig clone = config.clone(); assertEquals(config, clone); assertNotSame(config.getDefaultCachingGridSetIds(), clone.getDefaultCachingGridSetIds()); assertNotSame(config.getDefaultCoverageCacheFormats(), clone.getDefaultCoverageCacheFormats()); assertNotSame(config.getDefaultOtherCacheFormats(), clone.getDefaultOtherCacheFormats()); assertNotSame(config.getDefaultVectorCacheFormats(), clone.getDefaultVectorCacheFormats()); }
public void testCreateLayerGroup() { LayerGroupInfoImpl lg = mockGroup("tesGroup", mockLayer("L1",new String[]{}, LayerInfoImpl.Type.RASTER), mockLayer("L2",new String[]{}, LayerInfoImpl.Type.RASTER)); GeoServerTileLayerInfo info = defaultVectorInfo; info.setId(lg.getId()); info.setName(GWC.tileLayerName(lg)); info.getMimeFormats().clear(); info.getMimeFormats().addAll(defaults.getDefaultOtherCacheFormats()); GeoServerTileLayerInfo actual; actual = TileLayerInfoUtil.loadOrCreate(lg, defaults); assertEquals(info, actual); }
defaults.getDefaultVectorCacheFormats().clear(); defaults.getDefaultVectorCacheFormats().add("image/png8"); defaults.getDefaultOtherCacheFormats().clear(); defaults.getDefaultOtherCacheFormats().add("image/jpeg"); defaults.setCacheLayersByDefault(false); defaults.setCacheNonDefaultStyles(true);
public void testLoadLayerGroup() { LayerGroupInfoImpl lg = mockGroup("tesGroup", mockLayer("L1", new String[]{}, LayerInfoImpl.Type.RASTER), mockLayer("L2", new String[]{}, LayerInfoImpl.Type.RASTER)); assertNull(LegacyTileLayerInfoLoader.load(lg)); GeoServerTileLayerInfo info = defaultVectorInfo; info.getMimeFormats().clear(); info.getMimeFormats().addAll(defaults.getDefaultOtherCacheFormats()); LegacyTileLayerInfoLoader.save(info, lg.getMetadata()); GeoServerTileLayerInfo actual; actual = LegacyTileLayerInfoLoader.load(lg); info.setId(lg.getId()); info.setName(GWC.tileLayerName(lg)); assertEquals(info, actual); }
public void testClear() { LayerGroupInfoImpl lg = mockGroup("tesGroup", mockLayer("L1", new String[]{}, LayerInfoImpl.Type.RASTER), mockLayer("L2", new String[]{}, LayerInfoImpl.Type.RASTER)); assertNull(LegacyTileLayerInfoLoader.load(lg)); GeoServerTileLayerInfo info = defaultVectorInfo; info.getMimeFormats().clear(); info.getMimeFormats().addAll(defaults.getDefaultOtherCacheFormats()); LegacyTileLayerInfoLoader.save(info, lg.getMetadata()); GeoServerTileLayerInfo actual; actual = LegacyTileLayerInfoLoader.load(lg); assertNotNull(actual); LegacyTileLayerInfoLoader.clear(lg.getMetadata()); assertNull(LegacyTileLayerInfoLoader.load(lg)); }
public void testSaneConfig() { assertTrue(config.isSane()); assertSame(config, config.saneConfig()); assertTrue(oldDefaults.isSane()); assertSame(oldDefaults, oldDefaults.saneConfig()); config.setMetaTilingX(-1); assertFalse(config.isSane()); assertTrue((config = config.saneConfig()).isSane()); config.setMetaTilingY(-1); assertFalse(config.isSane()); assertTrue((config = config.saneConfig()).isSane()); config.setGutter(-1); assertFalse(config.isSane()); assertTrue((config = config.saneConfig()).isSane()); config.getDefaultCachingGridSetIds().clear(); assertFalse(config.isSane()); assertTrue((config = config.saneConfig()).isSane()); config.getDefaultCoverageCacheFormats().clear(); assertFalse(config.isSane()); assertTrue((config = config.saneConfig()).isSane()); config.getDefaultOtherCacheFormats().clear(); assertFalse(config.isSane()); assertTrue((config = config.saneConfig()).isSane()); config.getDefaultVectorCacheFormats().clear(); assertFalse(config.isSane()); assertTrue((config = config.saneConfig()).isSane()); }