Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1084660006 | ||
|
|
07bd7ac1c3 | ||
|
|
ef6cddc909 | ||
|
|
21fdc7fed5 | ||
|
|
e34ac27d07 | ||
|
|
4c7a803f74 | ||
|
|
4ea4e9e523 |
2
pom.xml
2
pom.xml
@ -14,7 +14,7 @@
|
|||||||
DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
DEALINGS IN * THE SOFTWARE. -->
|
DEALINGS IN * THE SOFTWARE. -->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -60,35 +60,37 @@ public class GSLayerEncoder extends PropertyXMLEncoder {
|
|||||||
else
|
else
|
||||||
set("enabled","false");
|
set("enabled","false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final static String DESCRIPTION = "description";
|
||||||
|
/**
|
||||||
|
* Add the 'description' node with a text value from 'description'
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected void addDescription(final String description) {
|
||||||
|
add(DESCRIPTION, description);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Set or modify the 'description' node with a text value from 'description'
|
||||||
|
*/
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
set(DESCRIPTION, description);
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// queryable
|
||||||
// * @param name the name of the layer
|
private final static String QUERYABLE = "queryable";
|
||||||
// */
|
/**
|
||||||
// protected void addName(final String name){
|
* Add the 'queryable' node with a text value from 'queryable' (true as default)
|
||||||
// add("name",name);
|
*/
|
||||||
// }
|
protected void addQueryable(final String queryable) {
|
||||||
//
|
add(QUERYABLE, queryable!=null?queryable.toString():"true");
|
||||||
// /**
|
}
|
||||||
// * @return name the name of the layer or null
|
/**
|
||||||
// */
|
* Set or modify the 'queryable' node with a text value from 'queryable' (true as default)
|
||||||
// public String getName() {
|
*/
|
||||||
// final Element nameNode = get("name");
|
public void setQueryable(final Boolean queryable) {
|
||||||
// if (nameNode != null)
|
set(QUERYABLE, queryable!=null?queryable.toString():"true");
|
||||||
// return nameNode.getText();
|
}
|
||||||
// else
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * @param name the name of the layer
|
|
||||||
// * @throws IllegalArgumentException
|
|
||||||
// */
|
|
||||||
// public void setName(final String name) throws IllegalArgumentException {
|
|
||||||
// if (name==null || name.isEmpty())
|
|
||||||
// throw new IllegalArgumentException("Unable to set an empty or null parameter");
|
|
||||||
// set("name",name);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see {@link GSLayerEncoder#setWmsPath(String)}
|
* @see {@link GSLayerEncoder#setWmsPath(String)}
|
||||||
*
|
*
|
||||||
|
|||||||
@ -194,6 +194,38 @@ public abstract class GSResourceEncoder
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final static String DESCRIPTION = "description";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the 'description' node with a text value from 'description'
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected void addDescription(final String description) {
|
||||||
|
add(DESCRIPTION, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set or modify the 'description' node with a text value from 'description'
|
||||||
|
*/
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
set(DESCRIPTION, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static String ABSTRACT = "abstract";
|
||||||
|
/**
|
||||||
|
* Add the 'abstract' node with a text value from 'abstract'
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected void addAbstract(final String _abstract) {
|
||||||
|
add(ABSTRACT, _abstract);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Set or modify the 'abstract' node with a text value from 'abstract'
|
||||||
|
*/
|
||||||
|
public void setAbstract(final String _abstract) {
|
||||||
|
set(ABSTRACT, _abstract);
|
||||||
|
}
|
||||||
|
|
||||||
private final static String TITLE = "title";
|
private final static String TITLE = "title";
|
||||||
|
|
||||||
|
|||||||
@ -229,7 +229,7 @@ public abstract class GeoserverRESTTest extends Assert {
|
|||||||
List<String> workspaces = reader.getWorkspaceNames();
|
List<String> workspaces = reader.getWorkspaceNames();
|
||||||
for (String workspace : workspaces) {
|
for (String workspace : workspaces) {
|
||||||
LOGGER.warn("Deleting Workspace " + workspace );
|
LOGGER.warn("Deleting Workspace " + workspace );
|
||||||
boolean removed = publisher.removeWorkspace(workspace,false);
|
boolean removed = publisher.removeWorkspace(workspace,true);
|
||||||
assertTrue("Workspace not removed " + workspace, removed );
|
assertTrue("Workspace not removed " + workspace, removed );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
package it.geosolutions.geoserver.rest.publisher;
|
package it.geosolutions.geoserver.rest.publisher;
|
||||||
|
|
||||||
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
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.decoder.RESTCoverageStore;
|
||||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
||||||
|
|
||||||
@ -33,6 +34,8 @@ import java.io.File;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -49,18 +52,19 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
|
|||||||
|
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTGeoTiffTest.class);
|
private final static Logger LOGGER = LoggerFactory.getLogger(GeoserverRESTGeoTiffTest.class);
|
||||||
|
|
||||||
|
String storeName = "testRESTStoreGeotiff";
|
||||||
|
String layerName = "resttestdem";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExternalGeotiff() throws FileNotFoundException, IOException {
|
public void testExternalGeotiff() throws FileNotFoundException, IOException {
|
||||||
if (!enabled()) return;
|
if (!enabled()) return;
|
||||||
deleteAll();
|
deleteAll();
|
||||||
|
|
||||||
String storeName = "testRESTStoreGeotiff";
|
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
|
||||||
String layerName = "resttestdem";
|
|
||||||
|
|
||||||
assertTrue(reader.getWorkspaces().isEmpty());
|
assertTrue(reader.getWorkspaces().isEmpty());
|
||||||
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
||||||
|
|
||||||
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
|
|
||||||
|
|
||||||
// known state?
|
// known state?
|
||||||
assertFalse("Cleanup failed", existsLayer(layerName));
|
assertFalse("Cleanup failed", existsLayer(layerName));
|
||||||
@ -87,14 +91,11 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
|
|||||||
if (!enabled()) return;
|
if (!enabled()) return;
|
||||||
deleteAll();
|
deleteAll();
|
||||||
|
|
||||||
String storeName = "testRESTStoreGeotiff";
|
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
|
||||||
String layerName = "resttestdem";
|
|
||||||
|
|
||||||
assertTrue(reader.getWorkspaces().isEmpty());
|
assertTrue(reader.getWorkspaces().isEmpty());
|
||||||
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
||||||
|
|
||||||
File geotiff = new ClassPathResource("testdata/resttestdem.tif").getFile();
|
|
||||||
|
|
||||||
// known state?
|
// known state?
|
||||||
assertFalse("Cleanup failed", existsLayer(layerName));
|
assertFalse("Cleanup failed", existsLayer(layerName));
|
||||||
|
|
||||||
@ -115,4 +116,23 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
|
|||||||
//delete
|
//delete
|
||||||
assertTrue("Unpublish() failed", publisher.removeCoverageStore(DEFAULT_WS, storeName,true));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,11 +105,10 @@ public class GeoserverRESTPublisherTest extends GeoserverRESTTest {
|
|||||||
String wsName = "this_ws_does_not_exist";
|
String wsName = "this_ws_does_not_exist";
|
||||||
String storeName = "this_store_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);
|
assertFalse("removed not existing datastore", ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public void testDeleteUnexistingFT() throws FileNotFoundException, IOException {
|
// public void testDeleteUnexistingFT() throws FileNotFoundException, IOException {
|
||||||
// String wsName = "this_ws_does_not_exist";
|
// String wsName = "this_ws_does_not_exist";
|
||||||
// String storeName = "this_store_does_not_exist";
|
// String storeName = "this_store_does_not_exist";
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package it.geosolutions.geoserver.rest.publisher;
|
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.GeoServerRESTPublisher.UploadMethod;
|
||||||
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
||||||
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
||||||
@ -39,6 +40,7 @@ import java.io.IOException;
|
|||||||
import org.apache.commons.httpclient.NameValuePair;
|
import org.apache.commons.httpclient.NameValuePair;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -62,13 +64,34 @@ public class GeoserverRESTShapeTest extends GeoserverRESTTest {
|
|||||||
deleteAllWorkspaces();
|
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
|
@Test
|
||||||
public void testPublishDeleteShapeZip() throws FileNotFoundException, IOException {
|
public void testPublishDeleteShapeZip() throws FileNotFoundException, IOException {
|
||||||
if (!enabled()) {
|
if (!enabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Assume.assumeTrue(enabled);
|
|
||||||
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
assertTrue(publisher.createWorkspace(DEFAULT_WS));
|
||||||
|
|
||||||
String storeName = "resttestshp";
|
String storeName = "resttestshp";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user