@Test public void testTimeKVPNow() throws Exception { String queryString = "request=getcoverage&service=wcs&version=1.0.0&format=image/geotiff" + "&bbox=0.237,40.562,14.593,44.558&crs=EPSG:4326&width=25&height=25&time=now" + "&coverage=" + getLayerId(WATTEMP); MockHttpServletResponse response = getAsServletResponse("wcs?" + queryString); checkPixelValue(response, 10, 10, 18.2849999185419); }
@Test public void testTimeSecond() throws Exception { String request = getWaterTempTimeRequest("2008-11-01T00:00:00.000Z"); MockHttpServletResponse response = postAsServletResponse("wcs", request); checkPixelValue(response, 10, 10, 18.2849999185419); }
@Test public void testTimeFirstKVP() throws Exception { String queryString = "request=getcoverage&service=wcs&version=1.0.0&format=image/geotiff" + "&bbox=0.237,40.562,14.593,44.558&crs=EPSG:4326&width=25&height=25&time=2008-10-31T00:00:00.000Z" + "&coverage=" + getLayerId(WATTEMP); MockHttpServletResponse response = getAsServletResponse("wcs?" + queryString); checkPixelValue(response, 10, 10, 18.2659999176394); }
@Test public void testTimeFirstPOST() throws Exception { String request = getWaterTempTimeRequest("2008-10-31T00:00:00.000Z"); MockHttpServletResponse response = postAsServletResponse("wcs", request); /* gdallocationinfo NCOM_wattemp_000_20081031T0000000_12.tiff 10 10 Report: Location: (10P,10L) Band 1: Value: 18.2659999176394 */ checkPixelValue(response, 10, 10, 18.2659999176394); }
@Test public void testElevationFirst() throws Exception { String request = getWaterTempElevationRequest("0.0"); MockHttpServletResponse response = postAsServletResponse("wcs", request); assertEquals("image/tiff", response.getContentType()); // same result as time first checkPixelValue(response, 10, 10, 18.2849999185419); request = request.replace("ELEVATION", "elevation"); response = postAsServletResponse("wcs", request); assertEquals("image/tiff", response.getContentType()); checkPixelValue(response, 10, 10, 18.2849999185419); }
@Test public void testElevationSecond() throws Exception { String request = getWaterTempElevationRequest("100.0"); MockHttpServletResponse response = postAsServletResponse("wcs", request); assertEquals("image/tiff", response.getContentType()); /* gdallocationinfo NCOM_wattemp_100_20081101T0000000_12.tiff 10 10 Report: Location: (10P,10L) Band 1: Value: 13.337999683572 */ checkPixelValue(response, 10, 10, 13.337999683572); request = request.replace("ELEVATION", "elevation"); response = postAsServletResponse("wcs", request); assertEquals("image/tiff", response.getContentType()); checkPixelValue(response, 10, 10, 13.337999683572); }
@Test public void testTimeRangeKVP() throws Exception { setupRasterDimension(TIMERANGES, ResourceInfo.TIME, DimensionPresentation.LIST, null); setupRasterDimension(TIMERANGES, ResourceInfo.ELEVATION, DimensionPresentation.LIST, null); String baseUrl = "wcs?request=getcoverage&service=wcs&version=1.0.0&format=image/geotiff" + "&bbox=0.237,40.562,14.593,44.558&crs=EPSG:4326&width=25&height=25" + "&coverage=" + getLayerId(TIMERANGES); // last range MockHttpServletResponse response = getAsServletResponse( baseUrl + "&TIME=2008-11-05T00:00:00.000Z/2008-11-06T12:00:00.000Z"); assertEquals("image/tiff", response.getContentType()); checkPixelValue(response, 10, 10, 13.337999683572); // middle hole, no data --> we should get back an exception Document dom = getAsDOM(baseUrl + "&TIME=2008-11-04T12:00:00.000Z/2008-11-04T16:00:00.000Z"); // print(dom); XMLAssert.assertXpathEvaluatesTo("1", "count(//ServiceExceptionReport)", dom); // first range response = getAsServletResponse( baseUrl + "&TIME=2008-10-31T12:00:00.000Z/2008-10-31T16:00:00.000Z"); assertEquals("image/tiff", response.getContentType()); checkPixelValue(response, 10, 10, 18.2659999176394); }