@Override protected void renameInfo(BlobStoreConfiguration config, String oldName, String newName) throws Exception { config.renameBlobStore(oldName, newName); }
/** * Renames an existing blob store. * * @param oldName The name of the existing blob store * @param newName The name to rename the blob store to * @throws IllegalArgumentException */ public synchronized void renameBlobStore(final String oldName, final String newName) throws NoSuchElementException, IllegalArgumentException { BlobStoreConfiguration config = getConfiguration(oldName); config.renameBlobStore(oldName, newName); // update layers for (TileLayer layer : layers.getLayerList()) { if (oldName.equals(layer.getBlobStoreId())) { layer.setBlobStoreId(newName); layers.modify(layer); } } }
@Test public void testListenerHearsRename() throws Exception { BlobStoreInfo goodInfo = this.getGoodInfo("test", 1); BlobStoreInfo expectedInfo = this.getGoodInfo("newName", 1); this.addInfo(this.config, goodInfo); BlobStoreConfigurationListener listener = EasyMock.createMock("listener", BlobStoreConfigurationListener.class); this.config.addBlobStoreListener(listener); listener.handleRenameBlobStore(EasyMock.eq("test"), EasyMock.eq(expectedInfo)); EasyMock.expectLastCall().once(); EasyMock.replay(listener); this.config.renameBlobStore("test", "newName"); EasyMock.verify(listener); }