@Test public void testMisconfiguredLayerIsSkippedWhenWMSServiceIsConfiguredThatWay() throws Exception { GeoServerInfo global = getGeoServer().getGlobal(); global.setResourceErrorHandling(ResourceErrorHandling.SKIP_MISCONFIGURED_LAYERS); getGeoServer().save(global); Document caps = getAsDOM("wms?service=WMS&request=GetCapabilities&version=1.1.1"); assertEquals("WMT_MS_Capabilities", caps.getDocumentElement().getTagName()); // we misconfigured all the layers in the server, so there should be no named layers now. XMLAssert.assertXpathEvaluatesTo("", "//Layer/Name/text()", caps); }
@Test public void testMisconfiguredLayerIsSkippedWhenWMSServiceIsConfiguredThatWay_1_3_0() throws Exception { GeoServerInfo global = getGeoServer().getGlobal(); global.setResourceErrorHandling(ResourceErrorHandling.SKIP_MISCONFIGURED_LAYERS); getGeoServer().save(global); Document caps = getAsDOM("wms?service=WMS&request=GetCapabilities&version=1.3.0"); assertEquals("WMS_Capabilities", caps.getDocumentElement().getTagName()); // we misconfigured all the layers in the server, so there should be no named layers now. XMLAssert.assertXpathEvaluatesTo("", "//Layer/Name/text()", caps); } }
@Before public void resetWmsConfigChanges() { GeoServerInfo global = getGeoServer().getGlobal(); global.setResourceErrorHandling(ResourceErrorHandling.OGC_EXCEPTION_REPORT); getGeoServer().save(global); }
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 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); // check we got everything but that specific layer, and that the output is still schema compliant Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0"); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); int count = getCatalog().getCoverages().size(); assertEquals(count - 1, dom.getElementsByTagName("wcs:CoverageOfferingBrief").getLength()); }
@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()); }
@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); // check we got everything but that specific layer, and that the output is still schema // compliant Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0"); checkValidationErrors(dom, WCS10_DESCRIBECOVERAGE_SCHEMA); int count = getCatalog().getCoverages().size(); assertEquals(count - 1, dom.getElementsByTagName("wcs:CoverageOfferingBrief").getLength()); }
@Test public void testSkipMisconfiguredLayers() throws Exception { // make sure AggregateGeoFeature is in the mock data set Document doc = getAsDOM("wfs?service=WFS&request=DescribeFeatureType&version=1.0.0"); assertEquals("xsd:schema", doc.getDocumentElement().getNodeName()); XMLAssert.assertXpathEvaluatesTo( "1", "count(//xsd:import[contains(@schemaLocation, 'AggregateGeoFeature')])", doc); // enable skipping of misconfigured layers GeoServerInfo global = getGeoServer().getGlobal(); global.setResourceErrorHandling(ResourceErrorHandling.SKIP_MISCONFIGURED_LAYERS); getGeoServer().save(global); // misconfigure a layer FeatureTypeInfo ftype = getCatalog().getFeatureTypeByName(CiteTestData.AGGREGATEGEOFEATURE.getLocalPart()); ftype.setNativeName("NOT ACTUALLY THERE"); getCatalog().save(ftype); // check the results again doc = getAsDOM("wfs?service=WFS&request=DescribeFeatureType&version=1.0.0"); assertEquals("xsd:schema", doc.getDocumentElement().getNodeName()); XMLAssert.assertXpathEvaluatesTo( "0", "count(//xsd:import[contains(@schemaLocation, 'AggregateGeoFeature')])", doc); }
@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 CoverageInfo cvInfo = getCatalog().getCoverageByName(getLayerId(MockData.TASMANIA_DEM)); ReferencedEnvelope BBox = cvInfo.getLatLonBoundingBox(); try { cvInfo.setLatLonBoundingBox(null); getCatalog().save(cvInfo); // check we got everything but that specific layer, and that the output is still schema // compliant Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.1.1"); checkValidationErrors(dom, WCS11_SCHEMA); // print(dom); int count = getCatalog().getCoverages().size(); assertEquals(count - 2, dom.getElementsByTagName("wcs:CoverageSummary").getLength()); } finally { cvInfo.setLatLonBoundingBox(BBox); getCatalog().save(cvInfo); } }
@Test public void testSkipMisconfiguredLayers() throws Exception { // configure geoserver to skip misconfigured layers GeoServerInfo global = getGeoServer().getGlobal(); global.setResourceErrorHandling(ResourceErrorHandling.SKIP_MISCONFIGURED_LAYERS); getGeoServer().save(global); // introduce misconfiguration FeatureTypeInfo ftype = getCatalog().getFeatureTypeByName(CiteTestData.UPDATES.getLocalPart()); ftype.setLatLonBoundingBox(null); getCatalog().save(ftype); // fetch capabilities document Document doc = getAsDOM("wfs?version=1.0.0&service=WFS&request=getCapabilities"); // print(doc); int count = 0; for (FeatureTypeInfo ft : getCatalog().getFeatureTypes()) { if (ft.enabled()) count++; } // print(doc); assertXpathEvaluatesTo(String.valueOf(count - 1), "count(//wfs:FeatureType)", doc); }