Configuration configuration = tld.removeGridset(gridSetId); changedConfigs.add(configuration);
@Test public void testRemoveGridsetException() throws IOException { String gridsetToRemove = GWCConfigIntegrationTestData.GRIDSET_EPSG2163; try { tileLayerDispatcher.removeGridSet(gridsetToRemove); fail("Expected exception removing a gridset referenced by a layer"); } catch (IllegalStateException e) { } // TODO: This behavior will change after the API change assertNull( "Expected failure removing null gridset", tileLayerDispatcher.removeGridset(null)); assertNull( "Expected failure removing nonexistant gridset", tileLayerDispatcher.removeGridset("nonexistantGridset")); } }
public void testRemoveAllLayerGridsetsDisablesLayer() throws Exception { when(tld.getConfiguration(same(tileLayer))).thenReturn(config); when(tld.getConfiguration(same(tileLayerGroup))).thenReturn(config); when(tld.modify(same(tileLayer))).thenReturn(config); when(tld.modify(same(tileLayerGroup))).thenReturn(config); when(tld.removeGridset(eq("EPSG:4326"))).thenReturn(config); when(tld.removeGridset(eq("EPSG:900913"))).thenReturn(config); // sanity check before modification assertTrue(tileLayer.getInfo().isEnabled()); assertTrue(tileLayer.getInfo().isEnabled()); mediator.removeGridSets(ImmutableSet.of("EPSG:900913", "EPSG:4326")); verify(config, times(1)).save();// all other checks are in testRemoveGridsets verify(storageBroker, times(1)).deleteByGridSetId(eq(tileLayer.getName()), eq("EPSG:4326")); verify(storageBroker, times(1)).deleteByGridSetId(eq(tileLayerGroup.getName()), eq("EPSG:900913")); verify(storageBroker, times(1)).deleteByGridSetId(eq(tileLayer.getName()), eq("EPSG:4326")); verify(storageBroker, times(1)).deleteByGridSetId(eq(tileLayerGroup.getName()), eq("EPSG:900913")); assertTrue(tileLayer.getGridSubsets().isEmpty()); assertTrue(tileLayerGroup.getGridSubsets().isEmpty()); // layers ended up with no gridsubsets, shall have been disabled assertFalse(tileLayer.getInfo().isEnabled()); assertFalse(tileLayerGroup.getInfo().isEnabled()); }
when(tld.modify(same(tileLayer))).thenReturn(config); when(tld.modify(same(tileLayerGroup))).thenReturn(config); when(tld.removeGridset(eq("EPSG:4326"))).thenReturn(config); when(tld.removeGridset(eq("My4326"))).thenReturn(config); verify(tld, times(1)).removeGridset(eq("EPSG:4326")); verify(tld, times(1)).removeGridset(eq("My4326"));