Added testcase trying to reproduce #11. Changed method to ProjectionPolicy.FORCE_DECLARED.

This commit is contained in:
Oscar Fonts 2012-06-26 18:26:39 +02:00
parent 6db046a626
commit 1fdc00ce4f
3 changed files with 35 additions and 1 deletions

View File

@ -1199,7 +1199,9 @@ public class GeoServerRESTPublisher {
String layerName, File zipFile, String nativeCrs,
String defaultStyle) throws FileNotFoundException, IllegalArgumentException {
return publishShp(workspace, storename, (NameValuePair[])null, layerName, UploadMethod.FILE, zipFile.toURI(), nativeCrs, ProjectionPolicy.NONE,defaultStyle);
return publishShp(workspace, storename, (NameValuePair[]) null,
layerName, UploadMethod.FILE, zipFile.toURI(), nativeCrs,
ProjectionPolicy.FORCE_DECLARED, defaultStyle);
}
/**

View File

@ -235,6 +235,38 @@ public class GeoserverRESTShapeTest extends GeoserverRESTTest {
}
/**
* Test case to solve error described in:
* https://github.com/geosolutions-it/geoserver-manager/issues/11
*
* @throws IllegalArgumentException
* @throws FileNotFoundException
*/
public void testPublishShpUsingDeclaredNativeCRS() throws Exception {
if (!enabled())
return;
// layer publication params
String workspace = DEFAULT_WS;
String storename = "resttestshp";
String layerName = "cities";
File zipFile = new ClassPathResource("testdata/testshp_no_prj.zip")
.getFile();
String nativeCrs = "EPSG:4230";
String defaultStyle = null;
// Cleanup
deleteAllWorkspacesRecursively();
assertTrue(publisher.createWorkspace(workspace));
// Publish layer
assertTrue(publisher.publishShp(workspace, storename, layerName,
zipFile, nativeCrs, defaultStyle));
// Read CRS. Should be using the one indicated at publication time.
assertNotNull(reader.getLayer(layerName));
}
// public void testDeleteUnexistingFT() throws FileNotFoundException, IOException {
// String wsName = "this_ws_does_not_exist";

Binary file not shown.