@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); }
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 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); }
public void testGetBasic() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0"); // print(dom); checkValidationErrors(dom, WCS10_GETCAPABILITIES_SCHEMA); }
public void testPostBasic() throws Exception { 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\"/>"; Document dom = postAsDOM(BASEPATH, request); // print(dom); checkValidationErrors(dom, WCS10_GETCAPABILITIES_SCHEMA); }
public void testUpdateSequenceSuperiorPost() throws Exception { 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=\"1\" version=\"1.0.0\"/>"; Document dom = postAsDOM(BASEPATH, request); checkOws11Exception(dom); }
public void testTimeCoverage() throws Exception { setupRasterDimension(ResourceInfo.TIME, DimensionPresentation.LIST, null); Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0"); // print(dom); checkValidationErrors(dom, WCS10_GETCAPABILITIES_SCHEMA); // check the envelopes String base = "//wcs:CoverageOfferingBrief[wcs:name='wcs:watertemp']//wcs:lonLatEnvelope"; assertXpathEvaluatesTo("2008-10-31T00:00:00.000Z", base + "/gml:timePosition[1]", dom); assertXpathEvaluatesTo("2008-11-01T00:00:00.000Z", base + "/gml:timePosition[2]", dom); } }
@Test public void testUnsupportedVersionGet() throws Exception { Document dom = getAsDOM( BASEPATH + "?request=GetCapabilities&service=WCS&acceptVersions=9.9.9,8.8.8"); checkValidationErrors(dom, WCS11_SCHEMA); checkOws11Exception(dom); assertXpathEvaluatesTo( "VersionNegotiationFailed", "ows:ExceptionReport/ows:Exception/@exceptionCode", dom); }
@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 testWorkspaceQualified() throws Exception { int all = getCatalog().getCoverageStores().size() - 1; Document dom = getAsDOM("wcs?request=GetCapabilities&service=WCS"); assertEquals(all, xpath.getMatchingNodes("//wcs:CoverageSummary", dom).getLength()); int some = getCatalog().getCoverageStoresByWorkspace("cdf").size(); assertTrue(some < all); dom = getAsDOM("cdf/wcs?request=GetCapabilities&service=WCS"); assertEquals(some, xpath.getMatchingNodes("//wcs:CoverageSummary", dom).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 testUnsupportedVersionPost() throws Exception { 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\">" + " <ows:AcceptVersions>" // + " <ows:Version>9.9.9</ows:Version>" // + " </ows:AcceptVersions>" // + "</wcs:GetCapabilities>"; Document dom = postAsDOM(BASEPATH, request); checkValidationErrors(dom, WCS11_SCHEMA); checkOws11Exception(dom); assertEquals("ows:ExceptionReport", dom.getFirstChild().getNodeName()); assertXpathEvaluatesTo( "VersionNegotiationFailed", "ows:ExceptionReport/ows:Exception/@exceptionCode", dom); }
@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()); }
public void testUpdateSequenceInferiorPost() throws Exception { 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=\"-1\"/>"; Document dom = postAsDOM(BASEPATH, request); checkValidationErrors(dom, WCS10_GETCAPABILITIES_SCHEMA); final Node root = dom.getFirstChild(); assertEquals("wcs:WCS_Capabilities", root.getNodeName()); assertTrue(root.getChildNodes().getLength() > 0); }
public void testUpdateSequenceInferiorGet() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&updateSequence=-1"); checkValidationErrors(dom, WCS10_GETCAPABILITIES_SCHEMA); final Node root = dom.getFirstChild(); assertEquals("wcs:WCS_Capabilities", root.getNodeName()); assertTrue(root.getChildNodes().getLength() > 0); }
@Test public void testNonAdvertisedLayer() throws Exception { String layerId = getLayerId(MockData.TASMANIA_DEM); LayerInfo layer = getCatalog().getLayerByName(layerId); try { // now you see me Document dom = getAsDOM("wcs?request=GetCapabilities"); assertXpathExists("//wcs:CoverageSummary[ows:Title='DEM']", dom); // now you don't! layer.setAdvertised(false); getCatalog().save(layer); dom = getAsDOM("wcs?request=GetCapabilities"); assertXpathNotExists("//wcs:CoverageSummary[ows:Title='DEM']", dom); } finally { layer.setAdvertised(true); getCatalog().save(layer); } }
public void testUpdateSequenceSuperiorGet() throws Exception { Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0&updateSequence=1"); // print(dom); checkOws11Exception(dom); }
public void testWorkspaceQualified() throws Exception { int expected = getCatalog().getCoverageStores().size(); Document dom = getAsDOM(BASEPATH + "?request=GetCapabilities&service=WCS&version=1.0.0"); assertEquals( expected, xpath.getMatchingNodes("//wcs:CoverageOfferingBrief", dom).getLength()); expected = getCatalog().getCoverageStoresByWorkspace(MockData.CDF_PREFIX).size(); dom = getAsDOM("cdf/wcs?request=GetCapabilities&service=WCS&version=1.0.0"); assertEquals( expected, xpath.getMatchingNodes("//wcs:CoverageOfferingBrief", dom).getLength()); }
@Before public void revertTasmaniaDem() throws IOException { getTestData().addDefaultRasterLayer(TASMANIA_DEM, getCatalog()); }