@Test public void testWorkspaceQualified() throws Exception { Document dom = getAsDOM( "cdf/wcs?request=DescribeCoverage&service=WCS&version=1.1.1&identifiers=" + TASMANIA_DEM.getLocalPart()); assertEquals("ows:ExceptionReport", dom.getDocumentElement().getNodeName()); dom = getAsDOM( "wcs?request=DescribeCoverage&service=WCS&version=1.1.1&identifiers=" + TASMANIA_DEM.getLocalPart()); assertEquals("wcs:CoverageDescriptions", dom.getDocumentElement().getNodeName()); }
@Test public void testDescribeNoIdentifiers() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.1.1"); // print(dom); assertEquals(1, dom.getElementsByTagName("ows:ExceptionReport").getLength()); Element element = (Element) dom.getElementsByTagName("ows:Exception").item(0); assertEquals("MissingParameterValue", element.getAttribute("exceptionCode")); assertEquals("identifiers", element.getAttribute("locator")); }
@Test public void testDescribeUnknownCoverageKvp() throws Exception { Document dom = getAsDOM( BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.1.1&identifiers=plop"); // print(dom); checkOws11Exception(dom); Element element = (Element) dom.getElementsByTagName("ows:Exception").item(0); assertEquals("InvalidParameterValue", element.getAttribute("exceptionCode")); assertEquals("identifiers", element.getAttribute("locator")); assertTrue(element.getTextContent().contains("plop")); }
@Test public void testDescribeMissingVersion() throws Exception { Document dom = getAsDOM( BASEPATH + "?request=DescribeCoverage&service=WCS&identifiers=" + getLayerId(TASMANIA_DEM)); // print(dom); checkOws11Exception(dom); Element element = (Element) dom.getElementsByTagName("ows:Exception").item(0); assertEquals("MissingParameterValue", element.getAttribute("exceptionCode")); assertEquals("version", element.getAttribute("locator")); }
public void testDescribeUnknownCoverageKvp() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=plop"); // print(dom); checkOws11Exception(dom); Element element = (Element) dom.getElementsByTagName("ServiceException").item(0); assertEquals("InvalidParameterValue", element.getAttribute("code")); assertEquals("coverage", element.getAttribute("locator")); assertTrue(element.getTextContent().contains("plop")); }
public void testDescribeMissingVersion() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&coverage=" + getLayerId(TASMANIA_DEM)); // print(dom); checkOws11Exception(dom); Element element = (Element) dom.getElementsByTagName("ServiceException").item(0); assertEquals("MissingParameterValue", element.getAttribute("code")); assertEquals("version", element.getAttribute("locator")); }
@Test public void testDescribeUnknownCoverageKvp() throws Exception { Document dom = getAsDOM( BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=plop"); // print(dom); checkOws11Exception(dom); Element element = (Element) dom.getElementsByTagName("ServiceException").item(0); assertEquals("InvalidParameterValue", element.getAttribute("code")); assertEquals("coverage", element.getAttribute("locator")); assertTrue(element.getTextContent().contains("plop")); }
public void testDescribeAll() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0"); // print(dom); // the response is compliant checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); // check all coverages have been described int count = getCatalog().getCoverages().size(); assertEquals(count, dom.getElementsByTagName("wcs:CoverageOffering").getLength()); }
@Test public void testDescribeMissingVersion() throws Exception { Document dom = getAsDOM( BASEPATH + "?request=DescribeCoverage&service=WCS&coverage=" + getLayerId(TASMANIA_DEM)); // print(dom); checkOws11Exception(dom); Element element = (Element) dom.getElementsByTagName("ServiceException").item(0); assertEquals("MissingParameterValue", element.getAttribute("code")); assertEquals("version", element.getAttribute("locator")); }
@Test public void testDescribeAll() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0"); // print(dom); // the response is compliant checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); // check all coverages have been described int count = getCatalog().getCoverages().size(); assertEquals(count, dom.getElementsByTagName("wcs:CoverageOffering").getLength()); }
public void testDescribeDemCoverageKvp() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=" + getLayerId(TASMANIA_DEM)); // print(dom); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); checkDemCoverageDescription(dom); }
@Test public void testDescribeDemCoverageKvp() throws Exception { Document dom = getAsDOM( BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.1.1&identifiers=" + getLayerId(TASMANIA_DEM)); checkValidationErrors(dom, WCS11_SCHEMA); checkDemCoverageDescription(dom); }
@Test public void testDescribeDemCoverageKvp() throws Exception { Document dom = getAsDOM( BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=" + getLayerId(TASMANIA_DEM)); // print(dom); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); checkDemCoverageDescription(dom); }
public void testSkipMisconfigured() throws Exception { // enable skipping of misconfigured layers GeoServerInfo global = getGeoServer().getGlobal(); global.setResourceErrorHandling(ResourceErrorHandling.SKIP_MISCONFIGURED_LAYERS); getGeoServer().save(global); // manually misconfigure one layer CoverageStoreInfo cvInfo = getCatalog().getCoverageStoreByName(MockData.TASMANIA_DEM.getLocalPart()); cvInfo.setURL("file:///I/AM/NOT/THERE"); getCatalog().save(cvInfo); Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0"); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); int count = getCatalog().getCoverages().size(); assertEquals(count - 1, dom.getElementsByTagName("wcs:CoverageOffering").getLength()); }
public void testElevationList() throws Exception { setupRasterDimension(ResourceInfo.ELEVATION, DimensionPresentation.LIST, null); Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=" + getLayerId(WATTEMP)); print(dom); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); // check the elevation list (it's the only way we can present it) assertXpathEvaluatesTo("0.0", "//wcs:AxisDescription[wcs:name = 'ELEVATION']/wcs:values/wcs:singleValue[1]", dom); assertXpathEvaluatesTo("100.0", "//wcs:AxisDescription[wcs:name = 'ELEVATION']/wcs:values/wcs:singleValue[2]", dom); assertXpathEvaluatesTo("0.0", "//wcs:AxisDescription[wcs:name = 'ELEVATION']/wcs:values/wcs:default", dom); }
@Test public void testSkipMisconfigured() throws Exception { // enable skipping of misconfigured layers GeoServerInfo global = getGeoServer().getGlobal(); global.setResourceErrorHandling(ResourceErrorHandling.SKIP_MISCONFIGURED_LAYERS); getGeoServer().save(global); // manually misconfigure one layer CoverageStoreInfo cvInfo = getCatalog().getCoverageStoreByName(MockData.TASMANIA_DEM.getLocalPart()); cvInfo.setURL("file:///I/AM/NOT/THERE"); getCatalog().save(cvInfo); Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0"); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); int count = getCatalog().getCoverages().size(); assertEquals(count - 1, dom.getElementsByTagName("wcs:CoverageOffering").getLength()); }
public void testTimeCoverageDiscreteInterval() throws Exception { setupRasterDimension(ResourceInfo.TIME, DimensionPresentation.DISCRETE_INTERVAL, new Double(1000 * 60 * 60)); Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=" + getLayerId(WATTEMP)); // print(dom); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); // check the envelopes assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//wcs:lonLatEnvelope/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//wcs:lonLatEnvelope/gml:timePosition[2]", dom); assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//gml:EnvelopeWithTimePeriod/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//gml:EnvelopeWithTimePeriod/gml:timePosition[2]", dom); // check the temporal domain assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//wcs:temporalDomain/wcs:timePeriod/wcs:beginPosition", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//wcs:temporalDomain/wcs:timePeriod/wcs:endPosition", dom); assertXpathEvaluatesTo("PT1H", "//wcs:temporalDomain/wcs:timePeriod/wcs:timeResolution", dom); }
public void testTimeCoverageList() throws Exception { setupRasterDimension(ResourceInfo.TIME, DimensionPresentation.LIST, null); Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=" + getLayerId(WATTEMP)); // print(dom); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); // check the envelopes assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//wcs:lonLatEnvelope/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//wcs:lonLatEnvelope/gml:timePosition[2]", dom); assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//gml:EnvelopeWithTimePeriod/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//gml:EnvelopeWithTimePeriod/gml:timePosition[2]", dom); // check the temporal domain assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//wcs:temporalDomain/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//wcs:temporalDomain/gml:timePosition[2]", dom); }
@Test public void testMetadataLinksTransormToProxyBaseURL() throws Exception { Catalog catalog = getCatalog(); CoverageInfo ci = catalog.getCoverageByName(getLayerId(TASMANIA_DEM)); MetadataLinkInfo ml = catalog.getFactory().createMetadataLink(); ml.setContent("/metadata?key=value"); ml.setAbout("http://www.geoserver.org"); ci.getMetadataLinks().add(ml); catalog.save(ci); String proxyBaseUrl = getGeoServer().getGlobal().getSettings().getProxyBaseUrl(); Document dom = getAsDOM( "wcs?request=DescribeCoverage&service=WCS&version=1.1.1&identifiers=" + TASMANIA_DEM.getLocalPart()); checkValidationErrors(dom, WCS11_SCHEMA); String xpathBase = "//wcs:CoverageDescription/ows:Metadata"; assertXpathEvaluatesTo("http://www.geoserver.org", xpathBase + "/@about", dom); assertXpathEvaluatesTo("simple", xpathBase + "/@xlink:type", dom); assertXpathEvaluatesTo( proxyBaseUrl + "/metadata?key=value", xpathBase + "/@xlink:href", dom); } }
public void testTimeCoverageContinousInterval() throws Exception { setupRasterDimension(ResourceInfo.TIME, DimensionPresentation.CONTINUOUS_INTERVAL, null); Document dom = getAsDOM(BASEPATH + "?request=DescribeCoverage&service=WCS&version=1.0.0&coverage=" + getLayerId(WATTEMP)); print(dom); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); // check the envelopes assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//wcs:lonLatEnvelope/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//wcs:lonLatEnvelope/gml:timePosition[2]", dom); assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//gml:EnvelopeWithTimePeriod/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//gml:EnvelopeWithTimePeriod/gml:timePosition[2]", dom); // check the temporal domain assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", "//wcs:temporalDomain/wcs:timePeriod/wcs:beginPosition", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", "//wcs:temporalDomain/wcs:timePeriod/wcs:endPosition", dom); }