/** * Notification that a layer has been added; to be called by {@link CatalogConfiguration} * whenever {@link CatalogConfiguration#save() save} is called and a layer has been renamed. * <p> * NOTE: this should be hanlded by GWC itself somehow, like with a configuration listener of * some sort. * * @param oldLayerName * @param newLayerName */ public void layerRenamed(String oldLayerName, String newLayerName) { try { log.info("Renaming GWC TileLayer '" + oldLayerName + "' as '" + newLayerName + "'"); // /embeddedConfig.rename(oldLayerName, newLayerName); storageBroker.rename(oldLayerName, newLayerName); } catch (StorageException e) { log.log(Level.WARNING, e.getMessage(), e); throw new RuntimeException(e); } }
/** * Notification that a layer has been added; to be called by {@link CatalogConfiguration} * whenever {@link CatalogConfiguration#save() save} is called and a layer has been renamed. * * <p>NOTE: this should be hanlded by GWC itself somehow, like with a configuration listener of * some sort. * * @param oldLayerName * @param newLayerName */ public void layerRenamed(String oldLayerName, String newLayerName) { try { log.info("Renaming GWC TileLayer '" + oldLayerName + "' as '" + newLayerName + "'"); // /embeddedConfig.rename(oldLayerName, newLayerName); storageBroker.rename(oldLayerName, newLayerName); } catch (StorageException e) { log.log(Level.WARNING, e.getMessage(), e); throw new RuntimeException(e); } }
public void testLayerRenamed() throws Exception { mediator.layerRenamed("old", "new"); verify(storageBroker, times(1)).rename(eq("old"), eq("new")); doThrow(new StorageException("target directory already exists")).when(storageBroker) .rename(eq("old"), eq("new")); try { mediator.layerRenamed("old", "new"); fail("Expected RTE"); } catch (RuntimeException e) { assertTrue(e.getCause() instanceof StorageException); } }