Cleaned up documentation, eliminated unused imports and useless method calls, reverted a class member to previous visibility, renamed a variable.

This commit is contained in:
Carl Schroedl 2016-09-22 16:01:50 -05:00
parent 769db7ff11
commit bf2e203614
5 changed files with 51 additions and 11 deletions

View File

@ -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);

View File

@ -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";

View File

@ -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<Content> children = new ArrayList<Content>(this.root.getContent());

View File

@ -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());

View File

@ -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 {