Skip to content

Commit

Permalink
[GEOS-8471] Add integration tests for embedded GWC seed form post (#2683
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tbarsballe committed Dec 13, 2017
1 parent 065b268 commit 1371797
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/gwc/src/test/java/org/geoserver/gwc/RESTIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.geoserver.catalog.Catalog;
import org.geoserver.data.test.MockData;
import org.geoserver.data.test.SystemTestData;
import org.geoserver.filters.BufferedRequestWrapper;
import org.geoserver.gwc.layer.GeoServerTileLayer;
import org.geoserver.gwc.layer.GeoServerTileLayerInfo;
import org.geoserver.gwc.layer.StyleParameterFilter;
Expand All @@ -40,6 +41,7 @@
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.w3c.dom.Document;

import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -581,7 +583,7 @@ public void testPostLegacyAutoStyles() throws Exception {
}

@Test
public void testGetSeed() throws Exception {
public void testGetSeedHtml() throws Exception {
final String layerName = getLayerId(MockData.BASIC_POLYGONS);
final String url = "gwc/rest/seed/" + layerName;
final String id = getCatalog().getLayerByName(layerName).getId();
Expand All @@ -591,6 +593,28 @@ public void testGetSeed() throws Exception {
assertTrue(sr.getContentType(), sr.getContentType().startsWith("text/html"));
}

@Test
public void testPostSeedHtmlForm() throws Exception {
final String layerName = getLayerId(MockData.BASIC_POLYGONS);
final String url = "gwc/rest/seed/" + layerName;
final String id = getCatalog().getLayerByName(layerName).getId();

final String formData = "threadCount=01&type=seed&gridSetId=EPSG%3A4326&tileFormat=image%2Fpng&zoomStart=00&zoomStop=12&minX=&minY=&maxX=&maxY=";

//Manually construct request and wrap in BufferedRequestWrapper so that the form data gets parsed as parameters
MockHttpServletRequest request = createRequest(url);
request.setMethod("POST");
request.setContentType("application/x-www-form-urlencoded");
request.setContent(formData.getBytes("UTF-8"));

BufferedRequestWrapper wrapper = new BufferedRequestWrapper(request, "UTF-8", formData.getBytes("UTF-8"));

MockHttpServletResponse sr = dispatch(wrapper);

assertEquals(200, sr.getStatus());
assertSeedJob(layerName);
}

@Test
public void testGetSeedJson() throws Exception {
final String layerName = getLayerId(MockData.BASIC_POLYGONS);
Expand Down

0 comments on commit 1371797

Please sign in to comment.