public void testAddTileLayer() throws Exception { when(tld.addLayer(same(tileLayer))).thenThrow(new IllegalArgumentException("fake")); when(tld.addLayer(same(tileLayerGroup))).thenReturn(config); try { mediator.add(tileLayer); fail("Expected IAE"); } catch (IllegalArgumentException e) { assertTrue(true); } mediator.add(tileLayerGroup); verify(config, times(1)).save(); }
/** * LayerInfo has been created, add a matching {@link GeoServerTileLayer} * * @see CatalogLayerEventListener#handleAddEvent * @see GWC#add(GeoServerTileLayer) */ void createTileLayer(final LayerInfo layerInfo) { GWCConfig defaults = mediator.getConfig(); if (defaults.isSane() && defaults.isCacheLayersByDefault()) { GridSetBroker gridSetBroker = mediator.getGridSetBroker(); GeoServerTileLayer tileLayer = new GeoServerTileLayer(layerInfo, defaults, gridSetBroker); mediator.add(tileLayer); } }
/** * LayerGroupInfo has been created, add a matching {@link GeoServerTileLayer} * * @see CatalogLayerEventListener#handleAddEvent * @see GWC#add(GeoServerTileLayer) */ public void createTileLayer(LayerGroupInfo lgi) { GWCConfig defaults = mediator.getConfig(); GridSetBroker gridSetBroker = mediator.getGridSetBroker(); GeoServerTileLayer tileLayer = new GeoServerTileLayer(lgi, defaults, gridSetBroker); mediator.add(tileLayer); }