Selective reload improvement fix to close issue 43

This commit is contained in:
ccancellieri 2012-09-25 13:39:40 +02:00
parent e34ac27d07
commit 21fdc7fed5
5 changed files with 1747 additions and 2064 deletions

View File

@ -229,7 +229,7 @@ public abstract class GeoserverRESTTest extends Assert {
List<String> workspaces = reader.getWorkspaceNames();
for (String workspace : workspaces) {
LOGGER.warn("Deleting Workspace " + workspace );
boolean removed = publisher.removeWorkspace(workspace,false);
boolean removed = publisher.removeWorkspace(workspace,true);
assertTrue("Workspace not removed " + workspace, removed );
}

View File

@ -26,6 +26,7 @@
package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.StoreType;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
@ -33,6 +34,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -49,18 +52,19 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTGeoTiffTest.class);
String storeName = "testRESTStoreGeotiff";
String layerName = "resttestdem";
@Test
public void testExternalGeotiff() throws FileNotFoundException, IOException {
if (!enabled()) return;
deleteAll();
String storeName = "testRESTStoreGeotiff";
String layerName = "resttestdem";
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
assertTrue(reader.getWorkspaces().isEmpty());
assertTrue(publisher.createWorkspace(DEFAULT_WS));
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
// known state?
assertFalse("Cleanup failed", existsLayer(layerName));
@ -87,14 +91,11 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
if (!enabled()) return;
deleteAll();
String storeName = "testRESTStoreGeotiff";
String layerName = "resttestdem";
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
assertTrue(reader.getWorkspaces().isEmpty());
assertTrue(publisher.createWorkspace(DEFAULT_WS));
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
// known state?
assertFalse("Cleanup failed", existsLayer(layerName));
@ -115,4 +116,23 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
//delete
assertTrue("Unpublish() failed", publisher.removeCoverageStore(DEFAULT_WS, storeName,true));
}
@Test
public void testReloadCoverageStore() throws FileNotFoundException, IOException {
if (!enabled()) return;
deleteAll();
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
assertTrue(publisher.createWorkspace(DEFAULT_WS));
// test insert
boolean pub = publisher.publishGeoTIFF(DEFAULT_WS, storeName, geotiff);
assertNotNull("publish() failed", pub);
// test reload
assertTrue(publisher.reloadStore(DEFAULT_WS, storeName, StoreType.COVERAGESTORES));
}
}

View File

@ -105,11 +105,10 @@ public class GeoserverRESTPublisherTest extends GeoserverRESTTest {
String wsName = "this_ws_does_not_exist";
String storeName = "this_store_does_not_exist";
boolean ok = publisher.removeDatastore(wsName, storeName);
boolean ok = publisher.removeDatastore(wsName, storeName,true);
assertFalse("removed not existing datastore", ok);
}
// public void testDeleteUnexistingFT() throws FileNotFoundException, IOException {
// String wsName = "this_ws_does_not_exist";
// String storeName = "this_store_does_not_exist";

View File

@ -25,6 +25,7 @@
package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.StoreType;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod;
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
@ -39,6 +40,7 @@ import java.io.IOException;
import org.apache.commons.httpclient.NameValuePair;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -62,13 +64,34 @@ public class GeoserverRESTShapeTest extends GeoserverRESTTest {
deleteAllWorkspaces();
}
}
@Test
public void testReloadDataStore() throws FileNotFoundException, IOException {
if (!enabled())
return;
assertTrue(publisher.createWorkspace(DEFAULT_WS));
String storeName = "resttestshp";
String layerName = "cities";
File zipFile = new ClassPathResource("testdata/resttestshp.zip").getFile();
// test insert
boolean published = publisher.publishShp(DEFAULT_WS, storeName, layerName, zipFile);
assertTrue("publish() failed", published);
// test reload
assertTrue(publisher.reloadStore(DEFAULT_WS, storeName, StoreType.DATASTORES));
}
@Test
public void testPublishDeleteShapeZip() throws FileNotFoundException, IOException {
if (!enabled()) {
return;
}
// Assume.assumeTrue(enabled);
assertTrue(publisher.createWorkspace(DEFAULT_WS));
String storeName = "resttestshp";