public List<CoverageInfo> getCoverages() { return delegate.getCoverages(); }
expect(catalog.getResources(CoverageInfo.class)).andReturn(coverages).anyTimes(); expect(catalog.getFeatureTypes()).andReturn(featureTypesAll).anyTimes(); expect(catalog.getCoverages()).andReturn(coveragesAll).anyTimes();
public List<CoverageInfo> getCoverages() { return filterResources(delegate.getCoverages()); }
public List<CoverageInfo> getCoverages() { return filterResources(user(), delegate.getCoverages()); }
@Test public void testAddCoverage() { assertNotNull(catalog.getCoverages()); assertTrue(catalog.getCoverages().isEmpty()); assertEquals(1, catalog.getCoverages().size()); assertEquals(2, catalog.getCoverages().size()); cv3.setName("cv3Name"); try { catalog.getCoverages().add(cv3); fail("adding directly should throw an exception"); } catch (Exception e) {
@Override protected List<String> load() { // get the list of coverages Catalog catalog = GeoServerApplication.get().getCatalog(); List<CoverageInfo> coverages = catalog.getCoverages(); // build the sorted list of names List<String> result = new ArrayList<String>(); for (CoverageInfo ci : coverages) { result.add(ci.getPrefixedName()); } Collections.sort(result); return result; }
@Override protected List<String> load() { // get the list of coverages Catalog catalog = GeoServerApplication.get().getCatalog(); List<CoverageInfo> coverages = catalog.getCoverages(); // build the sorted list of names List<String> result = new ArrayList<String>(); for (CoverageInfo ci : coverages) { result.add(ci.getPrefixedName()); } Collections.sort(result); return result; } }
new ArrayList<CoverageInfo>(wcs.getGeoServer().getCatalog().getCoverages());
List<CoverageInfo> coverages = catalog.getCoverages(); Collections.sort(coverages, new CoverageInfoLabelComparator()); for (CoverageInfo cvInfo : coverages) {
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 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()); }
final Set<CoverageInfo> coverages = new TreeSet<CoverageInfo>(new CoverageInfoLabelComparator()); coverages.addAll(wcs.getGeoServer().getCatalog().getCoverages());
@Test public void testRasterRenderingTx() throws Exception { System.out.println(getCatalog().getCoverages()); String layer = getLayerId(MockData.USA_WORLDIMG); String url = "wms?service=WMS&VERSION=1.1.1&request=GetMap&styles=" + "&format=image/png&layers=" + layer + "&WIDTH=100&HEIGHT=100" + "&srs=epsg:4326&BBOX=-130,49,-125,54"; BufferedImage image = getAsImage(url, "image/png"); Color color = getPixelColor(image, 25, 25); // the color is not white, nor white-ish assertTrue(color.getRed() + color.getGreen() + color.getBlue() < (250 * 3)); // now crop and check the image is cut url = "wms?service=WMS&VERSION=1.1.1&request=GetMap&styles=crop_raster" + "&format=image/png&layers=" + layer + "&WIDTH=100&HEIGHT=100" + "&srs=epsg:4326&BBOX=-130,49,-125,54"; image = getAsImage(url, "image/png"); color = getPixelColor(image, 25, 25); // the color is white, or white-ish assertTrue(color.getRed() + color.getGreen() + color.getBlue() > (250 * 3)); }
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 testDeleteRecursive() throws Exception { assertNotNull(catalog.getCoverageStoreByName("wcs", "BlueMarble")); MockHttpServletResponse response = deleteAsServletResponse( RestBaseController.ROOT_PATH + "/workspaces/wcs/coveragestores/BlueMarble?recurse=true"); assertEquals(200, response.getStatus()); assertNull(catalog.getCoverageStoreByName("wcs", "BlueMarble")); for (CoverageInfo c : catalog.getCoverages()) { if (c.getStore().getName().equals("BlueMarble")) { fail(); } } } }
@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); } }
@Override public void visit(Catalog catalog) { listDiffOther(catalog.getWorkspaces(), otherCatalog.getWorkspaces()); listDiffOther(catalog.getNamespaces(), otherCatalog.getNamespaces()); listDiffOther(catalog.getDataStores(), otherCatalog.getDataStores()); listDiffOther(catalog.getCoverageStores(), otherCatalog.getCoverageStores()); listDiffOther( catalog.getStores(WMSStoreInfo.class), otherCatalog.getStores(WMSStoreInfo.class)); listDiffOther(catalog.getFeatureTypes(), otherCatalog.getFeatureTypes()); listDiffOther(catalog.getCoverages(), otherCatalog.getCoverages()); listDiffOther(catalog.getLayers(), otherCatalog.getLayers()); listDiffOther( catalog.getResources(WMSLayerInfo.class), otherCatalog.getResources(WMSLayerInfo.class)); listDiffOther(catalog.getStyles(), otherCatalog.getStyles()); listDiffOther(catalog.getLayerGroups(), otherCatalog.getLayerGroups()); catalog.getWorkspaces().forEach(info -> info.accept(this)); catalog.getNamespaces().forEach(info -> info.accept(this)); catalog.getDataStores().forEach(info -> info.accept(this)); catalog.getCoverageStores().forEach(info -> info.accept(this)); catalog.getStores(WMSStoreInfo.class).forEach(info -> info.accept(this)); catalog.getFeatureTypes().forEach(info -> info.accept(this)); catalog.getCoverages().forEach(info -> info.accept(this)); catalog.getLayers().forEach(info -> info.accept(this)); catalog.getResources(WMSLayerInfo.class).forEach(info -> info.accept(this)); catalog.getStyles().forEach(info -> info.accept(this)); catalog.getLayerGroups().forEach(info -> info.accept(this)); }