Skip to content

Commit

Permalink
gwc - handles workspace-based paths (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmauduit committed Sep 27, 2024
1 parent df171dc commit aec8946
Show file tree
Hide file tree
Showing 574 changed files with 13,637 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,40 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;

import java.io.File;
import java.net.URISyntaxException;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
class GeoWebCacheApplicationTest {

@Autowired private TestRestTemplate restTemplate;

@Autowired private ApplicationContext context;

@DynamicPropertySource
static void dynamicProperties(DynamicPropertyRegistry registry) throws URISyntaxException {
File datadirLocation =
new File(
GeoWebCacheApplicationTest.class
.getResource("/test-data-directory")
.toURI());

registry.add("geoserver.backend.data-directory.location", datadirLocation::getAbsolutePath);
}

@BeforeEach
void before() {
restTemplate = restTemplate.withBasicAuth("admin", "geoserver");
Expand All @@ -53,6 +73,49 @@ void testRESTPathExtensionContentNegotiation() {
testGetRequestContentType("/gwc/rest/layers.xml", APPLICATION_XML);
}

@Test
void testGwcUrlHandlerMappingArePresentInTheClasspathAndLocalWorkspaceUrlsAreHandled() {
assertThat(context.isTypeMatch("gwcDemoUrlHandlerMapping", WebMvcRegistrations.class))
.as("expected a bean gwcDemoUrlHandlerMapping of type GwcUrlHandlerMapping")
.isTrue();
assertThat(context.isTypeMatch("gwcRestWebUrlHandlerMapping", WebMvcRegistrations.class))
.as("expected a bean gwcRestWebUrlHandlerMapping of type GwcUrlHandlerMapping")
.isTrue();

ResponseEntity<String> response =
restTemplate.getForEntity("/gwc/demo/ne:world", String.class);

assertThat(response.getStatusCode())
.as(
String.format(
"expected a HTTP return code 200, got %s",
response.getStatusCode()))
.isEqualTo(HttpStatus.OK);
}

@Test
void testGwcNamespacePrefixedDemo() {
ResponseEntity<String> response =
restTemplate.getForEntity("/ne/gwc/demo/world", String.class);

assertThat(response.getStatusCode())
.as(
String.format(
"expected a HTTP return code 200, got %s",
response.getStatusCode()))
.isEqualTo(HttpStatus.OK);

ResponseEntity<String> response2 =
restTemplate.getForEntity("/ne/gwc/demo/ne:world", String.class);

assertThat(response2.getStatusCode())
.as(
String.format(
"expected a HTTP return code 200, got %s",
response2.getStatusCode()))
.isEqualTo(HttpStatus.OK);
}

protected ResponseEntity<String> testGetRequestContentType(String uri, MediaType expected) {
ResponseEntity<String> response = restTemplate.getForEntity(uri, String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Included Data
=============

This directory provides a GeoServer data directory packaged as part of our product downloads:

* http://geoserver.org/display/GEOS/Download

The data directory includes the following sets of information:

* arc_sample
* img_sample
* mosaic_sample
* nyc (giant polygon, poi, poly landmark, tiger roads)
* sf (archsites,bugsites,restricted,roads,streams, sfdem)
* shapefiles(states)
* taz_shapes( cities, roads, state boundaries, water bodies)

ARC Sample
----------

Data was provided by GeoSolutions with redistribution rights.

IMG Sample
----------

Data was provided by GeoSolutions with redistribution rights.

MOASIC Sample
-------------

Data was provided by GeoSolutions with redistribution rights.

New York City
-------------

Data was provided by the Open Planning Project, processed from United States Census Bureau's Topologically Integrated Geographic Encoding and Referencing (TIGER) dataset.

Spearfish
---------

Spearfish sample data has been provided by GRASS.

* http://grass.osgeo.org/download/sample-data/

To quote from the http://grass.osgeo.org/uploads/grass/sampledata/spearDB.pdf ::

A majority of this spearfish database was initially provided to USACERL by the EROS Data Center
(EDC) in Sioux Falls, SD. The GRASS Development staff expresses acknowledgement and thanks to: the
U.S. Geological Survey (USGS) and EROS Data Center for allowing us to distribute this data with our
release of GRASS software; and to the U.S. Census Bureau for their samples of TIGER/Line data and the
STF1 data which were used in the development of the TIGER programs and tutorials. Thanks also to
SPOT Image Corporation for providing multispectral and panchromatic satellite imagery for a portion of
the spearfish data set and for allowing us to distribute this imagery with GRASS software. In addition to
the data provided by the EDC and SPOT, researchers at USACERL have developed several new layers, thus
enhancing the spearfish data set.

States
------

Coming from GeoTools sample data, simplified. The GeoTools file (statepop.shp) comes from Census data (by memory of people that imported it)

Tasmania
--------

The data is derived from the <Digital Chart of the World `http://en.wikipedia.org/wiki/Digital_Chart_of_the_World`> , which according to wikipedia is "is freely available as of 2006".

Referenced Copyright Statement:
http://en.wikipedia.org/wiki/Vector_map#Copyrights


The U.S. government has released the data into public domain, with the following conditions imposed (quotation from VMAP0 Copyright Statement)::

As an agency of the United States government, NIMA makes no copyright claim under Title 17 of the United States Code with respect to any copyrightable material compiled in these products, nor requires compensation for their use.
When incorporating the NIMA maps into your product, please include the following:
a. "this product was developed using materials from the United States National Imagery and Mapping Agency and are reproduced with permission",
b. "this product has neither been endorsed nor authorized by the United States National Imagery and Mapping Agency or the United States Department of Defense".

With respect to any advertising, promoting or publicizing of this product, NIMA requires that you refrain from using the agency's name, seal, or initials.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<coverage format = "arcGridSample" >
<name>Arc_Sample</name>
<label>A sample ArcGrid file</label>
<description>Generated from arcGridSample</description>
<wmspath>/</wmspath>
<metadataLink about = "" type = "" metadataType = "" >
null
</metadataLink>
<keywords>WCS,arcGridSample,arcGridSample_Coverage</keywords>
<!--
the default style this CoverageInfoDTO can be represented by.
at least must contain the "default" attribute
-->
<styles default = "rain">
<style>raster</style>
</styles>
<envelope crs = "GEOGCS['WGS 84',
DATUM['World Geodetic System 1984',
SPHEROID['WGS 84', 6378137.0, 298.257223563, AUTHORITY['EPSG','7030']],
AUTHORITY['EPSG','6326']],
PRIMEM['Greenwich', 0.0, AUTHORITY['EPSG','8901']],
UNIT['degree', 0.017453292519943295],
AXIS['Geodetic longitude', EAST],
AXIS['Geodetic latitude', NORTH],
AUTHORITY['EPSG','4326']]" srsName = "EPSG:4326" >
<pos>-180.0 -90.0</pos>
<pos>180.0 90.0</pos>
</envelope>
<grid dimension = "2" >
<low>0 0 </low>
<high>720 360 </high>
<axisName>precip30min</axisName>
<geoTransform >
<scaleX>0.5</scaleX>
<scaleY>-0.5</scaleY>
<shearX>0.0</shearX>
<shearY>0.0</shearY>
<translateX>-179.75</translateX>
<translateY>89.75</translateY>
</geoTransform>
</grid>
<CoverageDimension >
<name>precip30min</name>
<description>GridSampleDimension[-9999.0,8849.000000000002]</description>
<interval >
<min>-9999.0</min>
<max>8849.0</max>
</interval>
<nullValues >
</nullValues>
</CoverageDimension>
<supportedCRSs >
<requestCRSs>EPSG:4326</requestCRSs>
<responseCRSs>EPSG:4326</responseCRSs>
</supportedCRSs>
<supportedFormats nativeFormat = "ArcGrid" >
<formats>ARCGRID,ARCGRID-GZIP,GEOTIFF,PNG,GIF,TIFF</formats>
</supportedFormats>
<supportedInterpolations default = "nearest neighbor" >
<interpolationMethods>nearest neighbor</interpolationMethods>
</supportedInterpolations>
</coverage>
Loading

0 comments on commit aec8946

Please sign in to comment.