@Test public void testUpdateSequenceEqualsGet() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence(); Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&updateSequence=" + Long.toString(updateIndex)); checkValidationErrors(dom, WCS11_SCHEMA); final Node root = dom.getFirstChild(); assertEquals("wcs:Capabilities", root.getNodeName()); assertEquals(0, root.getChildNodes().getLength()); }
@Test public void testUpdateSequenceEqualsPost() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence(); String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs/1.1.1\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + Long.toString(updateIndex) + "\"/>"; Document dom = postAsDOM(BASEPATH, request); checkValidationErrors(dom, WCS11_SCHEMA); final Node root = dom.getFirstChild(); assertEquals("wcs:Capabilities", root.getNodeName()); assertEquals(0, root.getChildNodes().getLength()); }
@Test public void testUpdateSequenceEqualsGet() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence(); Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0&updateSequence=" + i); // print(dom); final Node root = dom.getFirstChild(); assertEquals("ServiceExceptionReport", root.getNodeName()); assertEquals( "CurrentUpdateSequence", root.getFirstChild() .getNextSibling() .getAttributes() .getNamedItem("code") .getNodeValue()); }
@Test public void testUpdateSequenceEqualsPost() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence(); String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + i + "\"/>"; Document dom = postAsDOM(BASEPATH, request); // print(dom); final Node root = dom.getFirstChild(); assertEquals("ServiceExceptionReport", root.getNodeName()); assertEquals( "CurrentUpdateSequence", root.getFirstChild() .getNextSibling() .getAttributes() .getNamedItem("code") .getNodeValue()); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); Catalog cat = getCatalog(); CoverageStoreInfo csi = cat.getCoverageStoreByName(SystemTestData.WORLD.getLocalPart()); csi.setEnabled(false); cat.save(csi); GeoServerInfo global = getGeoServer().getGlobal(); global.getSettings().setProxyBaseUrl("src/test/resources/geoserver"); 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); // 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 testUpdateSequenceSuperiorGet() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence() + 1; Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&updateSequence=" + Long.toString(updateIndex)); checkValidationErrors(dom, WCS11_SCHEMA); // print(dom); checkOws11Exception(dom); }
@Test public void testUpdateSequenceSuperiorPost() throws Exception { long updateIndex = getGeoServer().getGlobal().getUpdateSequence() + 1; String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs/1.1.1\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + Long.toString(updateIndex) + "\"/>"; Document dom = postAsDOM(BASEPATH, request); checkValidationErrors(dom, WCS11_SCHEMA); // print(dom); checkOws11Exception(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); // 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 testUpdateSequenceSuperiorGet() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence() + 1; Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0&updateSequence=" + i); // print(dom); checkOws11Exception(dom); }
@Test public void testUpdateSequenceSuperiorPost() throws Exception { long i = getGeoServer().getGlobal().getUpdateSequence() + 1; String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<wcs:GetCapabilities service=\"WCS\" xmlns:ows=\"http://www.opengis.net/ows/1.1\"" + " xmlns:wcs=\"http://www.opengis.net/wcs\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " updateSequence=\"" + i + "\" version=\"1.0.0\"/>"; Document dom = postAsDOM(BASEPATH, request); checkOws11Exception(dom); }
@Test public void testNoServiceContactInfo() throws Exception { // alter geoserver state so that there is no contact information getGeoServer().getGlobal().setContact(new ContactInfoImpl()); Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS"); // print(dom); checkValidationErrors(dom, WCS11_SCHEMA); }
@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 testMetadataLinksTransormToProxyBaseURL() throws Exception { GeoServerInfo global = getGeoServer().getGlobal(); global.getSettings().setProxyBaseUrl("src/test/resources/geoserver"); getGeoServer().save(global); catalog.save(ci); String proxyBaseUrl = getGeoServer().getGlobal().getSettings().getProxyBaseUrl(); Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0"); } finally { global.getSettings().setProxyBaseUrl(null); getGeoServer().save(global);
@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=GetCapabilities"); checkValidationErrors(dom, WCS11_SCHEMA); String xpathBase = "//wcs:CoverageSummary[wcs:Identifier = '" + TASMANIA_DEM.getPrefix() + ":" + TASMANIA_DEM.getLocalPart() + "']/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); }