diff --git a/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java b/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java index b025702..d77ac22 100644 --- a/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java +++ b/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java @@ -3292,7 +3292,6 @@ public class GeoServerRESTPublisher { */ public boolean recalculateFeatureTypeBBox(String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){ GSFeatureTypeEncoder fenc = new GSFeatureTypeEncoder(); - fenc.remove(GSFeatureTypeEncoder.ATTRIBUTES); fenc.setName(layerName); fenc.setEnabled(enabled); return recalculateBBox(StoreType.DATASTORES, fenc, workspace, storeName, layerName, calculationMode); @@ -3309,7 +3308,6 @@ public class GeoServerRESTPublisher { */ public boolean recalculateCoverageBBox(String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){ GSCoverageEncoder cenc = new GSCoverageEncoder(); - cenc.remove(GSCoverageEncoder.SUPPORTED_FORMATS); cenc.setName(layerName); cenc.setEnabled(enabled); return recalculateBBox(StoreType.COVERAGESTORES, cenc, workspace, storeName, layerName, calculationMode); diff --git a/src/main/java/it/geosolutions/geoserver/rest/encoder/coverage/GSCoverageEncoder.java b/src/main/java/it/geosolutions/geoserver/rest/encoder/coverage/GSCoverageEncoder.java index 796e122..4b506e1 100644 --- a/src/main/java/it/geosolutions/geoserver/rest/encoder/coverage/GSCoverageEncoder.java +++ b/src/main/java/it/geosolutions/geoserver/rest/encoder/coverage/GSCoverageEncoder.java @@ -44,7 +44,7 @@ public class GSCoverageEncoder extends GSResourceEncoder { public final static String NATIVECOVERAGENAME = "nativeCoverageName"; private final static String NATIVE_FORMAT="nativeFormat"; - public final static String SUPPORTED_FORMATS="supportedFormats"; + private final static String SUPPORTED_FORMATS="supportedFormats"; private final static String REQUEST_SRS="requestSRS"; private final static String RESPONSE_SRS="responseSRS"; diff --git a/src/main/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElement.java b/src/main/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElement.java index aa7649d..4e13876 100644 --- a/src/main/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElement.java +++ b/src/main/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElement.java @@ -31,8 +31,6 @@ import java.util.List; import org.jdom.Content; import org.jdom.Element; import org.jdom.Text; -import org.jdom.filter.ContentFilter; -import org.jdom.filter.ElementFilter; import org.jdom.output.Format; import org.jdom.output.XMLOutputter; @@ -126,6 +124,10 @@ public class XmlElement{ return false; } + + /** + * Recursively removes all child nodes that have no contents. + */ public void recursivelyRemoveEmptyChildren(){ //must make a copy to avoid ConcurrentModificationException List children = new ArrayList(this.root.getContent()); diff --git a/src/test/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElementTest.java b/src/test/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElementTest.java index 3345737..0c1e87d 100644 --- a/src/test/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElementTest.java +++ b/src/test/java/it/geosolutions/geoserver/rest/encoder/utils/XmlElementTest.java @@ -1,3 +1,28 @@ +/* + * GeoServer-Manager - Simple Manager Library for GeoServer + * + * Copyright (C) 2007,2011 GeoSolutions S.A.S. + * http://www.geo-solutions.it + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + package it.geosolutions.geoserver.rest.encoder.utils; import java.io.IOException; @@ -10,13 +35,22 @@ import org.jdom.output.XMLOutputter; import org.junit.Test; import static org.junit.Assert.*; +/** + * Tests XmlElements + * @author Carl Schroedl - cschroedl@usgs.gov + */ public class XmlElementTest { - private XmlElement makeElement(String docString){ + /** + * Creates an XmlElement from a String + * @param xmlString + * @return the specified String as an XmlElement + */ + private XmlElement makeElement(String xmlString){ Document doc; SAXBuilder builder = new SAXBuilder(); try { - doc = builder.build(new StringReader(docString)); + doc = builder.build(new StringReader(xmlString)); } catch (JDOMException ex) { throw new RuntimeException(ex); } catch (IOException ex) { @@ -27,6 +61,12 @@ public class XmlElementTest { return new XmlElement(root); } + /** + * Asserts that the serializations of two XmlElements are the same. + * @param message + * @param expected + * @param actual + */ private void assertEqualXml(String message, XmlElement expected, XmlElement actual){ XMLOutputter out = new XMLOutputter(); String expectedElementString = out.outputString(expected.getRoot()); diff --git a/src/test/java/it/geosolutions/geoserver/rest/publisher/GeoserverRESTRecalculateTest.java b/src/test/java/it/geosolutions/geoserver/rest/publisher/GeoserverRESTRecalculateTest.java index 841d8d4..d7461c6 100644 --- a/src/test/java/it/geosolutions/geoserver/rest/publisher/GeoserverRESTRecalculateTest.java +++ b/src/test/java/it/geosolutions/geoserver/rest/publisher/GeoserverRESTRecalculateTest.java @@ -41,11 +41,11 @@ import org.slf4j.LoggerFactory; import org.springframework.core.io.ClassPathResource; /** - * Testcase for publishing layers on geoserver. - * We need a running GeoServer to properly run the tests. - * If such geoserver instance cannot be contacted, tests will be skipped. + * Test case for recalculating the bounding box for features and coverages on + * GeoServer. We need a running GeoServer to properly run the tests. + * If such GeoServer instance cannot be contacted, tests will be skipped. * - * @author Carl Schroedl - cschroedl@usgs.gov + * @author Carl Schroedl - cschroedl@usgs.gov */ public class GeoserverRESTRecalculateTest extends GeoserverRESTTest {