fix GSCoverageEncoder. fix integration some test. TODO run integration tests.
This commit is contained in:
parent
1c60c1d94a
commit
0f833b2664
@ -43,8 +43,9 @@ import org.jdom.Namespace;
|
||||
* Parse a resource (FeatureType or Coverage) returned as XML REST objects.
|
||||
*
|
||||
* @author etj
|
||||
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com |
|
||||
* emmanuel.blondel@fao.org
|
||||
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
|
||||
* @author Henry Rotzoll
|
||||
*
|
||||
*/
|
||||
public class RESTResource {
|
||||
protected final Element rootElem;
|
||||
@ -90,7 +91,6 @@ public class RESTResource {
|
||||
return kwdsList;
|
||||
}
|
||||
|
||||
|
||||
public String getNameSpace() {
|
||||
return rootElem.getChild("namespace").getChildText("name");
|
||||
}
|
||||
@ -157,7 +157,7 @@ public class RESTResource {
|
||||
/**
|
||||
* Decodes the list of MetadataLinkInfo from the GeoServer Resource
|
||||
*
|
||||
* @author Emmanuel Blondel
|
||||
* @since gs-2.4.x
|
||||
*
|
||||
* @return the list of GSMetadataLinkEncoder
|
||||
*/
|
||||
@ -168,13 +168,15 @@ public class RESTResource {
|
||||
if (metaLinksRoot != null) {
|
||||
final List<Element> metaLinks = metaLinksRoot.getChildren();
|
||||
if (metaLinks != null) {
|
||||
metaLinksList = new ArrayList<GSMetadataLinkInfoEncoder>(
|
||||
metaLinks.size());
|
||||
metaLinksList = new ArrayList<GSMetadataLinkInfoEncoder>(metaLinks.size());
|
||||
for (Element metaLink : metaLinks) {
|
||||
final GSMetadataLinkInfoEncoder metaLinkEnc = new GSMetadataLinkInfoEncoder();
|
||||
metaLinkEnc.setType(metaLink.getChildText(ResourceMetadataLinkInfo.type.name()));
|
||||
metaLinkEnc.setMetadataType(metaLink.getChildText(ResourceMetadataLinkInfo.metadataType.name()));
|
||||
metaLinkEnc.setContent(metaLink.getChildText(ResourceMetadataLinkInfo.content.name()));
|
||||
metaLinkEnc
|
||||
.setType(metaLink.getChildText(ResourceMetadataLinkInfo.type.name()));
|
||||
metaLinkEnc.setMetadataType(metaLink
|
||||
.getChildText(ResourceMetadataLinkInfo.metadataType.name()));
|
||||
metaLinkEnc.setContent(metaLink.getChildText(ResourceMetadataLinkInfo.content
|
||||
.name()));
|
||||
metaLinksList.add(metaLinkEnc);
|
||||
}
|
||||
|
||||
@ -186,41 +188,37 @@ public class RESTResource {
|
||||
/**
|
||||
* Decodes the list of GSCoverageDimensionEncoder from the GeoServer Resource
|
||||
*
|
||||
* @author Henry Rotzoll
|
||||
* @since gs-2.4.x
|
||||
*
|
||||
* @return the list of GSCoverageDimensionEncoder
|
||||
*/
|
||||
public List<GSCoverageDimensionEncoder> getEncodedDimensionsInfoList()
|
||||
{
|
||||
public List<GSCoverageDimensionEncoder> getEncodedDimensionsInfoList() {
|
||||
List<GSCoverageDimensionEncoder> dimensionList = null;
|
||||
final Element dimensionsRoot = rootElem.getChild("dimensions");
|
||||
|
||||
if(dimensionsRoot!=null)
|
||||
{
|
||||
if (dimensionsRoot != null) {
|
||||
final List<Element> dimensions = dimensionsRoot.getChildren();
|
||||
if (dimensions != null)
|
||||
{
|
||||
if (dimensions != null) {
|
||||
dimensionList = new ArrayList<GSCoverageDimensionEncoder>(dimensions.size());
|
||||
for (Element coverageDimension : dimensions)
|
||||
{
|
||||
for (Element coverageDimension : dimensions) {
|
||||
final String name = coverageDimension.getChildText("name");
|
||||
final String description = coverageDimension.getChildText("description");
|
||||
String rangeMin = null;
|
||||
String rangeMax = null;
|
||||
final Element rangeElement = coverageDimension.getChild("range");
|
||||
if(rangeElement != null)
|
||||
{
|
||||
if (rangeElement != null) {
|
||||
rangeMin = rangeElement.getChildText("min");
|
||||
rangeMax = rangeElement.getChildText("max");
|
||||
}
|
||||
final String unit = coverageDimension.getChildText("unit");
|
||||
String dimensionTypeName = null;
|
||||
final Element dimensionTypeElement = coverageDimension.getChild("dimensionType");
|
||||
if(dimensionTypeElement != null)
|
||||
{
|
||||
final Element dimensionTypeElement = coverageDimension
|
||||
.getChild("dimensionType");
|
||||
if (dimensionTypeElement != null) {
|
||||
dimensionTypeName = dimensionTypeElement.getChildText("name");
|
||||
}
|
||||
final GSCoverageDimensionEncoder coverageDimensionEncoder = new GSCoverageDimensionEncoder(name, description, rangeMin, rangeMax, unit, dimensionTypeName);
|
||||
final GSCoverageDimensionEncoder coverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
||||
name, description, rangeMin, rangeMax, unit, dimensionTypeName);
|
||||
dimensionList.add(coverageDimensionEncoder);
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
package it.geosolutions.geoserver.rest.encoder;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.dimensions.GSCoverageDimensionEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
|
||||
@ -48,22 +47,25 @@ import org.jdom.filter.Filter;
|
||||
*
|
||||
* @author ETj (etj at geo-solutions.it)
|
||||
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
|
||||
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com |
|
||||
* emmanuel.blondel@fao.org
|
||||
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
|
||||
* @author Henry Rotzoll
|
||||
*/
|
||||
public abstract class GSResourceEncoder
|
||||
extends PropertyXMLEncoder {
|
||||
public abstract class GSResourceEncoder extends PropertyXMLEncoder {
|
||||
public final static String NAME = "name";
|
||||
|
||||
public final static String NATIVENAME = "nativeName";
|
||||
|
||||
public final static String METADATA = "metadata";
|
||||
|
||||
public final static String KEYWORDS = "keywords";
|
||||
|
||||
public final static String METADATALINKS = "metadataLinks";
|
||||
public final static String DIMENSIONS="dimensions";
|
||||
|
||||
final private GSMetadataEncoder metadata = new GSMetadataEncoder();
|
||||
|
||||
final private Element keywordsListEncoder = new Element(KEYWORDS);
|
||||
|
||||
final private Element metadataLinksListEncoder = new Element(METADATALINKS);
|
||||
final private Element dimensionsEncoder = new Element(DIMENSIONS);
|
||||
|
||||
private class GSMetadataEncoder extends NestedElementEncoder {
|
||||
public GSMetadataEncoder() {
|
||||
@ -72,8 +74,7 @@ public abstract class GSResourceEncoder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rootName
|
||||
* Actually 'feature' or 'coverage'
|
||||
* @param rootName Actually 'feature' or 'coverage'
|
||||
* @see GSFeatureTypeEncoder
|
||||
* @see GSCoverageEncoder
|
||||
*/
|
||||
@ -91,7 +92,6 @@ public abstract class GSResourceEncoder
|
||||
set("enabled", (enabled) ? "true" : "false");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param dimensionInfo
|
||||
@ -124,7 +124,8 @@ public abstract class GSResourceEncoder
|
||||
* @param dimensionInfo {@link GSDimensionInfoEncoder} with additional information about the dimension
|
||||
* @param custom is the dimension custom or not?
|
||||
*/
|
||||
protected void addMetadataDimension(String key, GSDimensionInfoEncoder dimensionInfo, boolean custom) {
|
||||
protected void addMetadataDimension(String key, GSDimensionInfoEncoder dimensionInfo,
|
||||
boolean custom) {
|
||||
if (custom) {
|
||||
metadata.set("custom_dimension_" + key.toUpperCase(), dimensionInfo.getRoot());
|
||||
} else {
|
||||
@ -147,23 +148,23 @@ public abstract class GSResourceEncoder
|
||||
* @param dimensionInfo {@link GSDimensionInfoEncoder} with additional information about the dimension
|
||||
* @param custom is the dimension custom or not?
|
||||
*/
|
||||
public void setMetadataDimension(String key, GSDimensionInfoEncoder dimensionInfo, boolean custom) {
|
||||
public void setMetadataDimension(String key, GSDimensionInfoEncoder dimensionInfo,
|
||||
boolean custom) {
|
||||
if (custom) {
|
||||
metadata.set("custom_dimension_" + key.toUpperCase(), dimensionInfo.getRoot());
|
||||
} else {
|
||||
metadata.set(key, dimensionInfo.getRoot());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* the name of the metadata to add (f.e.: elevation, time)
|
||||
* @param key the name of the metadata to add (f.e.: elevation, time)
|
||||
* @return true if something is removed, false otherwise
|
||||
*/
|
||||
public boolean delMetadata(String key) {
|
||||
return metadata.remove(key);
|
||||
}
|
||||
|
||||
|
||||
public void addKeyword(String keyword) {
|
||||
final Element el = new Element("string");
|
||||
el.setText(keyword);
|
||||
@ -196,7 +197,6 @@ public abstract class GSResourceEncoder
|
||||
*
|
||||
* @param MetadataLink
|
||||
*
|
||||
* @author Emmanuel Blondel
|
||||
*/
|
||||
public void addMetadataLinkInfo(GSMetadataLinkInfoEncoder metadataLinkInfo) {
|
||||
metadataLinksListEncoder.addContent(metadataLinkInfo.getRoot());
|
||||
@ -205,82 +205,28 @@ public abstract class GSResourceEncoder
|
||||
/**
|
||||
* Adds quickly a MetadataLinkInfo to the GeoServer Resource
|
||||
*
|
||||
* @author Emmanuel Blondel
|
||||
*
|
||||
* @param type
|
||||
* @param metadataType
|
||||
* @param content
|
||||
*/
|
||||
public void addMetadataLinkInfo(String type, String metadataType,
|
||||
String content) {
|
||||
final GSMetadataLinkInfoEncoder mde = new GSMetadataLinkInfoEncoder(
|
||||
type, metadataType, content);
|
||||
public void addMetadataLinkInfo(String type, String metadataType, String content) {
|
||||
final GSMetadataLinkInfoEncoder mde = new GSMetadataLinkInfoEncoder(type, metadataType,
|
||||
content);
|
||||
metadataLinksListEncoder.addContent(mde.getRoot());
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a metadataLinkInfo from the list using the metadataURL
|
||||
* (MetadataLinkInfo content)
|
||||
*
|
||||
* @author Emmanuel Blondel
|
||||
* Deletes a metadataLinkInfo from the list using the metadataURL (MetadataLinkInfo content)
|
||||
*
|
||||
* @param metadataURL
|
||||
* @return true if something is removed, false otherwise
|
||||
*/
|
||||
public boolean delMetadataLinkInfo(final String metadataURL) {
|
||||
return (metadataLinksListEncoder
|
||||
.removeContent(GSMetadataLinkInfoEncoder
|
||||
.getFilterByContent(metadataURL))).size() == 0 ? false
|
||||
: true;
|
||||
return (metadataLinksListEncoder.removeContent(GSMetadataLinkInfoEncoder
|
||||
.getFilterByContent(metadataURL))).size() == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a CoverageDimensionInfo to the GeoServer Resource
|
||||
*
|
||||
* @param coverageDimensionInfo
|
||||
*
|
||||
* @author Henry Rotzoll
|
||||
*/
|
||||
public void addCoverageDimensionInfo (GSCoverageDimensionEncoder coverageDimensionInfo) {
|
||||
if(ElementUtils.contains(getRoot(), DIMENSIONS) == null)addContent(dimensionsEncoder);
|
||||
dimensionsEncoder.addContent(coverageDimensionInfo.getRoot());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds quickly a CoverageDimensionInfo to the GeoServer Resource
|
||||
*
|
||||
* @author Henry Rotzoll
|
||||
*
|
||||
* @param name
|
||||
* @param description
|
||||
* @param rangeMin
|
||||
* @param rangeMax
|
||||
* @param unit
|
||||
* @param dimensionType
|
||||
*/
|
||||
public void addCoverageDimensionInfo(String name, String description, String rangeMin, String rangeMax, String unit, String dimensionType) {
|
||||
final GSCoverageDimensionEncoder coverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
||||
name, description, rangeMin, rangeMax, unit, dimensionType);
|
||||
addCoverageDimensionInfo(coverageDimensionEncoder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a CoverageDimensionInfo from the list using the CoverageDimension Name
|
||||
* (CoverageDimensionInfo content)
|
||||
*
|
||||
* @author Henry Rotzoll
|
||||
*
|
||||
* @param coverageDimensionName
|
||||
* @return true if something is removed, false otherwise
|
||||
*/
|
||||
public boolean delCoverageDimensionInfo(final String coverageDimensionName) {
|
||||
return (dimensionsEncoder
|
||||
.removeContent(GSCoverageDimensionEncoder
|
||||
.getFilterByContent(coverageDimensionName))).size() == 0 ? false
|
||||
: true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reprojection policy for a published layer. One of:
|
||||
* <ul>
|
||||
@ -341,7 +287,6 @@ public abstract class GSResourceEncoder
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the 'nativename' node with a text value from 'name'
|
||||
*
|
||||
@ -351,19 +296,16 @@ public abstract class GSResourceEncoder
|
||||
add(NATIVENAME, nativename);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set or modify the 'nativename' node with a text value from 'name'
|
||||
*
|
||||
* @note if not specified, the nativeName will be set with the value of the
|
||||
* 'name' node.
|
||||
* @note if not specified, the nativeName will be set with the value of the 'name' node.
|
||||
*
|
||||
*/
|
||||
public void setNativeName(final String nativename) {
|
||||
set(NATIVENAME, nativename);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the nativeName
|
||||
*
|
||||
@ -377,7 +319,6 @@ public abstract class GSResourceEncoder
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private final static String DESCRIPTION = "description";
|
||||
|
||||
/**
|
||||
@ -396,6 +337,7 @@ public abstract class GSResourceEncoder
|
||||
}
|
||||
|
||||
private final static String ABSTRACT = "abstract";
|
||||
|
||||
/**
|
||||
* Add the 'abstract' node with a text value from 'abstract'
|
||||
*
|
||||
@ -403,6 +345,7 @@ public abstract class GSResourceEncoder
|
||||
protected void addAbstract(final String _abstract) {
|
||||
add(ABSTRACT, _abstract);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set or modify the 'abstract' node with a text value from 'abstract'
|
||||
*/
|
||||
@ -460,9 +403,13 @@ public abstract class GSResourceEncoder
|
||||
}
|
||||
|
||||
private final static String LATLONBBMINX = "latLonBoundingBox/minx";
|
||||
|
||||
private final static String LATLONBBMAXX = "latLonBoundingBox/maxx";
|
||||
|
||||
private final static String LATLONBBMINY = "latLonBoundingBox/miny";
|
||||
|
||||
private final static String LATLONBBMAXY = "latLonBoundingBox/maxy";
|
||||
|
||||
private final static String LATLONBBCRS = "latLonBoundingBox/crs";
|
||||
|
||||
/**
|
||||
@ -473,8 +420,8 @@ public abstract class GSResourceEncoder
|
||||
* @param miny
|
||||
* @param crs
|
||||
*/
|
||||
protected void addLatLonBoundingBox(double minx, double miny, double maxx,
|
||||
double maxy, final String crs) {
|
||||
protected void addLatLonBoundingBox(double minx, double miny, double maxx, double maxy,
|
||||
final String crs) {
|
||||
add(LATLONBBMINX, String.valueOf(minx));
|
||||
add(LATLONBBMINY, String.valueOf(miny));
|
||||
add(LATLONBBMAXY, String.valueOf(maxy));
|
||||
@ -482,8 +429,8 @@ public abstract class GSResourceEncoder
|
||||
add(LATLONBBCRS, crs);
|
||||
}
|
||||
|
||||
public void setLatLonBoundingBox(double minx, double miny, double maxx,
|
||||
double maxy, final String crs) {
|
||||
public void setLatLonBoundingBox(double minx, double miny, double maxx, double maxy,
|
||||
final String crs) {
|
||||
set(LATLONBBMINX, String.valueOf(minx));
|
||||
set(LATLONBBMAXY, String.valueOf(maxy));
|
||||
set(LATLONBBMAXX, String.valueOf(maxx));
|
||||
@ -492,9 +439,13 @@ public abstract class GSResourceEncoder
|
||||
}
|
||||
|
||||
private final static String NATIVEBBMINX = "nativeBoundingBox/minx";
|
||||
|
||||
private final static String NATIVEBBMAXX = "nativeBoundingBox/maxx";
|
||||
|
||||
private final static String NATIVEBBMINY = "nativeBoundingBox/miny";
|
||||
|
||||
private final static String NATIVEBBMAXY = "nativeBoundingBox/maxy";
|
||||
|
||||
private final static String NATIVEBBCRS = "nativeBoundingBox/crs";
|
||||
|
||||
/**
|
||||
@ -504,8 +455,8 @@ public abstract class GSResourceEncoder
|
||||
* @param miny
|
||||
* @param crs
|
||||
*/
|
||||
protected void addNativeBoundingBox(double minx, double miny, double maxx,
|
||||
double maxy, final String crs) {
|
||||
protected void addNativeBoundingBox(double minx, double miny, double maxx, double maxy,
|
||||
final String crs) {
|
||||
add(NATIVEBBMINX, String.valueOf(minx));
|
||||
add(NATIVEBBMAXY, String.valueOf(maxy));
|
||||
add(NATIVEBBMAXX, String.valueOf(maxx));
|
||||
@ -513,8 +464,8 @@ public abstract class GSResourceEncoder
|
||||
add(NATIVEBBCRS, crs);
|
||||
}
|
||||
|
||||
public void setNativeBoundingBox(double minx, double miny, double maxx,
|
||||
double maxy, final String crs) {
|
||||
public void setNativeBoundingBox(double minx, double miny, double maxx, double maxy,
|
||||
final String crs) {
|
||||
set(NATIVEBBMINX, String.valueOf(minx));
|
||||
set(NATIVEBBMAXY, String.valueOf(maxy));
|
||||
set(NATIVEBBMAXX, String.valueOf(maxx));
|
||||
|
||||
@ -25,9 +25,12 @@
|
||||
|
||||
package it.geosolutions.geoserver.rest.encoder.coverage;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import org.jdom.Element;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.dimensions.GSCoverageDimensionEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
|
||||
|
||||
/**
|
||||
* Creates an XML
|
||||
@ -38,8 +41,13 @@ import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
*/
|
||||
public class GSCoverageEncoder extends GSResourceEncoder {
|
||||
|
||||
public final static String DIMENSIONS = "dimensions";
|
||||
|
||||
final private Element dimensionsEncoder = new Element(DIMENSIONS);
|
||||
|
||||
public GSCoverageEncoder() {
|
||||
super("coverage");
|
||||
addContent(dimensionsEncoder);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,4 +67,44 @@ public class GSCoverageEncoder extends GSResourceEncoder {
|
||||
public void setMetadata(String key, GSDimensionInfoEncoder dimensionInfo) {
|
||||
super.setMetadata(key, dimensionInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a CoverageDimensionInfo to the GeoServer Resource
|
||||
*
|
||||
* @param coverageDimensionInfo
|
||||
*
|
||||
*/
|
||||
public void addCoverageDimensionInfo(GSCoverageDimensionEncoder coverageDimensionInfo) {
|
||||
if (ElementUtils.contains(getRoot(), DIMENSIONS) == null)
|
||||
addContent(dimensionsEncoder);
|
||||
dimensionsEncoder.addContent(coverageDimensionInfo.getRoot());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds quickly a CoverageDimensionInfo to the GeoServer Resource
|
||||
*
|
||||
* @param name
|
||||
* @param description
|
||||
* @param rangeMin
|
||||
* @param rangeMax
|
||||
* @param unit
|
||||
* @param dimensionType
|
||||
*/
|
||||
public void addCoverageDimensionInfo(String name, String description, String rangeMin,
|
||||
String rangeMax, String unit, String dimensionType) {
|
||||
final GSCoverageDimensionEncoder coverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
||||
name, description, rangeMin, rangeMax, unit, dimensionType);
|
||||
addCoverageDimensionInfo(coverageDimensionEncoder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a CoverageDimensionInfo from the list using the CoverageDimension Name (CoverageDimensionInfo content)
|
||||
*
|
||||
* @param coverageDimensionName
|
||||
* @return true if something is removed, false otherwise
|
||||
*/
|
||||
public boolean delCoverageDimensionInfo(final String coverageDimensionName) {
|
||||
return (dimensionsEncoder.removeContent(GSCoverageDimensionEncoder
|
||||
.getFilterByContent(coverageDimensionName))).size() == 0 ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,15 +31,19 @@ import org.jdom.Element;
|
||||
import org.jdom.filter.Filter;
|
||||
|
||||
/**
|
||||
* GSCoverageDimension - encodes a CoverageDimension for a given GeoServer Resource
|
||||
* (feature type /coverage), as follows:
|
||||
* GSCoverageDimension - encodes a CoverageDimension for a given GeoServer Resource (feature type /coverage), as follows:
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* final GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder("GRAY_INDEX", "GridSampleDimension[-2.147483648E9,-2.147483648E9]", String.valueOf(Integer.MIN_VALUE), String.valueOf(Integer.MAX_VALUE), "dobson units³", "REAL_32BITS");
|
||||
* final GSCoverageDimensionEncoder gsCoverageDimensionEncoder =
|
||||
* new GSCoverageDimensionEncoder("GRAY_INDEX", "GridSampleDimension[-2.147483648E9,-2.147483648E9]",
|
||||
* String.valueOf(Integer.MIN_VALUE), String.valueOf(Integer.MAX_VALUE), "dobson units³", "REAL_32BITS");
|
||||
* coverageEncoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* For this example, the XML output is:
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* <coverageDimension>
|
||||
@ -62,7 +66,8 @@ import org.jdom.filter.Filter;
|
||||
*/
|
||||
public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
|
||||
/** A class to filter the GSCoverageDimension by content
|
||||
/**
|
||||
* A class to filter the GSCoverageDimension by content
|
||||
*
|
||||
*
|
||||
*/
|
||||
@ -77,8 +82,7 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public boolean matches(Object obj) {
|
||||
Element el = ((Element) obj)
|
||||
.getChild("name");
|
||||
Element el = ((Element) obj).getChild("name");
|
||||
if (el != null && el.getTextTrim().equals(key)) {
|
||||
return true;
|
||||
}
|
||||
@ -114,7 +118,8 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
* @param unit
|
||||
* @param dimensionTypeName
|
||||
*/
|
||||
public GSCoverageDimensionEncoder(String name, String description, String rangeMin, String rangeMax, String unit, String dimensionTypeName) {
|
||||
public GSCoverageDimensionEncoder(String name, String description, String rangeMin,
|
||||
String rangeMax, String unit, String dimensionTypeName) {
|
||||
super("coverageDimension");
|
||||
this.setup(name, description, rangeMin, rangeMax, unit, dimensionTypeName);
|
||||
}
|
||||
@ -129,8 +134,8 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
* @param unit
|
||||
* @param dimensionTypeName
|
||||
*/
|
||||
protected void setup(String name, String description, String rangeMin, String rangeMax, String unit, String dimensionTypeName)
|
||||
{
|
||||
protected void setup(String name, String description, String rangeMin, String rangeMax,
|
||||
String unit, String dimensionTypeName) {
|
||||
// name
|
||||
setName(name);
|
||||
|
||||
@ -147,7 +152,6 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
setDimensionType(dimensionTypeName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of the GSCoverageDimensionEncoder member
|
||||
*
|
||||
@ -169,9 +173,9 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
* @return true if the GSCoverageDimensionEncoder member is removed
|
||||
*/
|
||||
protected boolean delMemberIfExists(String memberName) {
|
||||
if(ElementUtils.contains(getRoot(), memberName) != null)
|
||||
{
|
||||
return ElementUtils.remove(this.getRoot(), this.getRoot().getChild(memberName.toString()));
|
||||
if (ElementUtils.contains(getRoot(), memberName) != null) {
|
||||
return ElementUtils.remove(this.getRoot(),
|
||||
this.getRoot().getChild(memberName.toString()));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -184,8 +188,8 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
* @param memberValue
|
||||
*/
|
||||
protected void setMember(String memberName, String memberValue) {
|
||||
if(memberName != null && !memberName.isEmpty() && memberValue != null && !memberValue.isEmpty())
|
||||
{
|
||||
if (memberName != null && !memberName.isEmpty() && memberValue != null
|
||||
&& !memberValue.isEmpty()) {
|
||||
delMemberIfExists(memberName); // delete the element if it already exists
|
||||
addMember(memberName.toString(), memberValue);
|
||||
}
|
||||
@ -198,8 +202,8 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
* @param memberValue
|
||||
*/
|
||||
protected void addMember(String memberName, String memberValue) {
|
||||
if(memberName != null && !memberName.isEmpty() && memberValue != null && ! memberValue.isEmpty())
|
||||
{
|
||||
if (memberName != null && !memberName.isEmpty() && memberValue != null
|
||||
&& !memberValue.isEmpty()) {
|
||||
set(memberName.toString(), memberValue);
|
||||
}
|
||||
}
|
||||
@ -266,8 +270,7 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
* @param range
|
||||
*/
|
||||
public void setRange(String rangeMin, String rangeMax) {
|
||||
if(rangeMin != null && !rangeMin.isEmpty() && rangeMax != null && !rangeMax.isEmpty())
|
||||
{
|
||||
if (rangeMin != null && !rangeMin.isEmpty() && rangeMax != null && !rangeMax.isEmpty()) {
|
||||
remove("range");
|
||||
|
||||
final Element rangeElement = new Element("range");
|
||||
@ -298,8 +301,7 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
*/
|
||||
public String getRangeMin() {
|
||||
final Element range = this.getRoot().getChild("range");
|
||||
if(range != null)
|
||||
{
|
||||
if (range != null) {
|
||||
return range.getChildText("min");
|
||||
}
|
||||
|
||||
@ -313,8 +315,7 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
*/
|
||||
public String getRangeMax() {
|
||||
final Element range = this.getRoot().getChild("range");
|
||||
if(range != null)
|
||||
{
|
||||
if (range != null) {
|
||||
return range.getChildText("max");
|
||||
}
|
||||
|
||||
@ -355,8 +356,7 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
* @param dimensionType
|
||||
*/
|
||||
public void setDimensionType(String dimensionTypeName) {
|
||||
if(dimensionTypeName != null && !dimensionTypeName.isEmpty())
|
||||
{
|
||||
if (dimensionTypeName != null && !dimensionTypeName.isEmpty()) {
|
||||
remove("dimensionType");
|
||||
|
||||
final Element dimensionTypeElement = new Element("dimensionType");
|
||||
@ -384,8 +384,7 @@ public class GSCoverageDimensionEncoder extends XmlElement {
|
||||
*/
|
||||
public String getDimensionTypeName() {
|
||||
final Element dimensionType = this.getRoot().getChild("dimensionType");
|
||||
if(dimensionType != null)
|
||||
{
|
||||
if (dimensionType != null) {
|
||||
return dimensionType.getChildText("name");
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ import org.springframework.core.io.ClassPathResource;
|
||||
*/
|
||||
public class ResourceDecoderTest {
|
||||
|
||||
|
||||
RESTCoverage coverage;
|
||||
|
||||
@Before
|
||||
@ -78,7 +77,8 @@ public class ResourceDecoderTest {
|
||||
|
||||
@Test
|
||||
public void testStoreUrl() {
|
||||
Assert.assertEquals(coverage.getStoreUrl(), "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/granuleTestMosaic.xml");
|
||||
Assert.assertEquals(coverage.getStoreUrl(),
|
||||
"http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/granuleTestMosaic.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -94,7 +94,6 @@ public class ResourceDecoderTest {
|
||||
Assert.assertEquals(coverage.getMaxY(), 90, 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMetadataLinkInfo() throws IOException {
|
||||
|
||||
@ -119,12 +118,12 @@ public class ResourceDecoderTest {
|
||||
|
||||
GSCoverageDimensionEncoder coverageDimension1 = list.get(0);
|
||||
Assert.assertEquals("GRAY_INDEX", coverageDimension1.getName());
|
||||
Assert.assertEquals("GridSampleDimension[-Infinity,Infinity]", coverageDimension1.getDescription());
|
||||
Assert.assertEquals("GridSampleDimension[-Infinity,Infinity]",
|
||||
coverageDimension1.getDescription());
|
||||
Assert.assertEquals("-inf", coverageDimension1.getRangeMin());
|
||||
Assert.assertEquals("inf", coverageDimension1.getRangeMax());
|
||||
Assert.assertEquals("dobson units³", coverageDimension1.getUnit());
|
||||
Assert.assertEquals("REAL_32BITS", coverageDimension1.getDimensionTypeName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ package it.geosolutions.geoserver.rest.encoder.coverage;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
||||
import it.geosolutions.geoserver.rest.encoder.dimensions.GSCoverageDimensionEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
|
||||
@ -105,6 +106,8 @@ public class GSCoverageEncoderTest extends TestCase {
|
||||
encoder.addKeyword("...");
|
||||
encoder.addKeyword("KEYWORD_N");
|
||||
|
||||
|
||||
// Old style dimensions (into metadata)
|
||||
final GSDimensionInfoEncoder timeDimension=new GSDimensionInfoEncoder(true);
|
||||
timeDimension.setPresentation(Presentation.CONTINUOUS_INTERVAL);
|
||||
encoder.setMetadata("time", timeDimension);
|
||||
@ -120,6 +123,12 @@ public class GSCoverageEncoderTest extends TestCase {
|
||||
elevationDimension.setPresentation(Presentation.LIST);
|
||||
encoder.setMetadata("elevation", elevationDimension);
|
||||
|
||||
// New style dimensions (since gs-2.4.x)
|
||||
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
||||
"GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf",
|
||||
"dobson units³", "REAL_32BITS");
|
||||
encoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||
|
||||
if (LOGGER.isInfoEnabled())
|
||||
LOGGER.info(encoder.toString());
|
||||
|
||||
|
||||
@ -19,6 +19,12 @@
|
||||
*/
|
||||
package it.geosolutions.geoserver.rest.encoder.dimensions;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
@ -32,7 +38,9 @@ public class GSCoverageDimensionEncoderTest {
|
||||
|
||||
@Test
|
||||
public void coverageDimensionTest() {
|
||||
GSCoverageDimensionEncoder encoder = new GSCoverageDimensionEncoder("GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf", "dobson units³", "REAL_32BITS");
|
||||
GSCoverageDimensionEncoder encoder = new GSCoverageDimensionEncoder("GRAY_INDEX",
|
||||
"GridSampleDimension[-Infinity,Infinity]", "-inf", "inf", "dobson units³",
|
||||
"REAL_32BITS");
|
||||
|
||||
Assert.assertEquals("GRAY_INDEX", encoder.getName());
|
||||
Assert.assertEquals("GridSampleDimension[-Infinity,Infinity]", encoder.getDescription());
|
||||
@ -67,4 +75,5 @@ public class GSCoverageDimensionEncoderTest {
|
||||
Assert.assertEquals("dobson units³", encoder.getUnit());
|
||||
Assert.assertEquals("REAL_32BITS", encoder.getDimensionTypeName());
|
||||
}
|
||||
|
||||
}
|
||||
@ -53,15 +53,12 @@ import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* Note on adding multiple available styles to the GSLayerEncoder: - to run the
|
||||
* testIntegration(), 2 clones of the "point" style, named "point2" and "point3"
|
||||
* have to be created.
|
||||
* Note on adding multiple available styles to the GSLayerEncoder: - to run the testIntegration(), 2 clones of the "point" style, named "point2" and
|
||||
* "point3" have to be created.
|
||||
*
|
||||
* @author ETj (etj at geo-solutions.it)
|
||||
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
|
||||
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com |
|
||||
* emmanuel.blondel@fao.org
|
||||
* @author Henry Rotzoll (henry.rotzoll@dlr.de)
|
||||
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
|
||||
*/
|
||||
public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
protected final static Logger LOGGER = LoggerFactory.getLogger(GSFeatureEncoderTest.class);
|
||||
@ -88,14 +85,10 @@ public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
fte.setEnabled(true);
|
||||
|
||||
// metadataLink
|
||||
GSMetadataLinkInfoEncoder metadatalink = new GSMetadataLinkInfoEncoder(
|
||||
"text/xml", "ISO19115:2003",
|
||||
"http://www.organization.org/metadata1");
|
||||
GSMetadataLinkInfoEncoder metadatalink = new GSMetadataLinkInfoEncoder("text/xml",
|
||||
"ISO19115:2003", "http://www.organization.org/metadata1");
|
||||
fte.addMetadataLinkInfo(metadatalink);
|
||||
|
||||
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder("GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf", "dobson units³", "REAL_32BITS");
|
||||
fte.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||
|
||||
GSLayerEncoder layerEncoder = null;
|
||||
if (!GSVersionDecoder.VERSION.getVersion(VERSION).equals(
|
||||
GSVersionDecoder.VERSION.UNRECOGNIZED)) {
|
||||
@ -113,31 +106,29 @@ public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
layerEncoder.addStyle("point3");
|
||||
|
||||
// authorityURL
|
||||
GSAuthorityURLInfoEncoder authorityURL = new GSAuthorityURLInfoEncoder(
|
||||
"authority1", "http://www.authority1.org");
|
||||
GSAuthorityURLInfoEncoder authorityURL = new GSAuthorityURLInfoEncoder("authority1",
|
||||
"http://www.authority1.org");
|
||||
layerEncoder.addAuthorityURL(authorityURL);
|
||||
|
||||
// identifier
|
||||
GSIdentifierInfoEncoder identifier1 = new GSIdentifierInfoEncoder(
|
||||
"authority1", "identifier1");
|
||||
GSIdentifierInfoEncoder identifier2 = new GSIdentifierInfoEncoder(
|
||||
"authority1", "another_identifier");
|
||||
GSIdentifierInfoEncoder identifier1 = new GSIdentifierInfoEncoder("authority1",
|
||||
"identifier1");
|
||||
GSIdentifierInfoEncoder identifier2 = new GSIdentifierInfoEncoder("authority1",
|
||||
"another_identifier");
|
||||
layerEncoder.addIdentifier(identifier1);
|
||||
layerEncoder.addIdentifier(identifier2);
|
||||
|
||||
publisher.createWorkspace(DEFAULT_WS);
|
||||
|
||||
File zipFile = new ClassPathResource("testdata/resttestshp.zip")
|
||||
.getFile();
|
||||
File zipFile = new ClassPathResource("testdata/resttestshp.zip").getFile();
|
||||
|
||||
// test insert
|
||||
boolean published = publisher.publishShp(DEFAULT_WS, storeName,
|
||||
layerName, zipFile);
|
||||
boolean published = publisher.publishShp(DEFAULT_WS, storeName, layerName, zipFile);
|
||||
assertTrue("publish() failed", published);
|
||||
assertTrue(existsLayer(layerName));
|
||||
|
||||
publisher.publishStyle(new File(new ClassPathResource("testdata")
|
||||
.getFile(), "default_point.sld"));
|
||||
publisher.publishStyle(new File(new ClassPathResource("testdata").getFile(),
|
||||
"default_point.sld"));
|
||||
|
||||
// optionally select the attributes to publish
|
||||
RESTLayer layer = reader.getLayer(layerName);
|
||||
@ -148,28 +139,10 @@ public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
fte.setAttribute(enc);
|
||||
}
|
||||
|
||||
assertTrue(publisher.publishDBLayer(DEFAULT_WS, storeName, fte,
|
||||
layerEncoder));
|
||||
assertTrue(publisher.publishDBLayer(DEFAULT_WS, storeName, fte, layerEncoder));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCoverageDimension() throws IOException {
|
||||
GSFeatureTypeEncoder fte = new GSFeatureTypeEncoder();
|
||||
fte.setNativeName("testlayer");
|
||||
fte.setName("testlayer" + "_NEW");
|
||||
fte.setTitle("title");
|
||||
fte.setNativeCRS("EPSG:4326");
|
||||
fte.setDescription("desc");
|
||||
fte.setEnabled(true);
|
||||
|
||||
assertFalse(fte.toString().contains("<dimensions><coverageDimension><name>GRAY_INDEX</name><description>GridSampleDimension[-Infinity,Infinity]</description><range><min>-inf</min><max>inf</max></range><unit>dobson units³</unit><dimensionType><name>REAL_32BITS</name></dimensionType></coverageDimension></dimensions>"));
|
||||
|
||||
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder("GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf", "dobson units³", "REAL_32BITS");
|
||||
fte.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||
LOGGER.debug("fte.toString() :" + fte.toString());
|
||||
assertTrue(fte.toString().contains("<dimensions><coverageDimension><name>GRAY_INDEX</name><description>GridSampleDimension[-Infinity,Infinity]</description><range><min>-inf</min><max>inf</max></range><unit>dobson units³</unit><dimensionType><name>REAL_32BITS</name></dimensionType></coverageDimension></dimensions>"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@ -259,8 +232,10 @@ public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
assertFalse(encoder.delKeyword("KEYWORD_M"));
|
||||
|
||||
// metadataLinkInfo
|
||||
encoder.addMetadataLinkInfo("text/xml", "ISO19115:2003","http://www.organization.org/metadata1");
|
||||
encoder.addMetadataLinkInfo("text/html", "ISO19115:2003","http://www.organization.org/metadata2");
|
||||
encoder.addMetadataLinkInfo("text/xml", "ISO19115:2003",
|
||||
"http://www.organization.org/metadata1");
|
||||
encoder.addMetadataLinkInfo("text/html", "ISO19115:2003",
|
||||
"http://www.organization.org/metadata2");
|
||||
|
||||
assertTrue(encoder.delMetadataLinkInfo("http://www.organization.org/metadata2"));
|
||||
assertFalse(encoder.delMetadataLinkInfo("http://www.organization.org/metadata3"));
|
||||
@ -275,8 +250,7 @@ public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
final String metadata = "elevation";
|
||||
encoder.setMetadataDimension(metadata, elevationDimension);
|
||||
|
||||
elevationDimension.setPresentation(Presentation.DISCRETE_INTERVAL,
|
||||
BigDecimal.valueOf(10));
|
||||
elevationDimension.setPresentation(Presentation.DISCRETE_INTERVAL, BigDecimal.valueOf(10));
|
||||
|
||||
if (LOGGER.isInfoEnabled())
|
||||
LOGGER.info(encoder.toString());
|
||||
@ -297,12 +271,10 @@ public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
/**
|
||||
* Test method for virtual table encoding / SQL view layer integration
|
||||
*
|
||||
* Settings information for integration tests
|
||||
* - test is based on the data used in http://docs.geoserver.org/latest/en/user/data/database/sqlview.html#parameterizing-sql-views
|
||||
* (states shapefile - available in testdata/states.zip)
|
||||
* - create a postgis db
|
||||
* - import the states shapefile (using shp2pgsql or Postgis shapefile uploader)
|
||||
* - In Geoserver, create a postgis datastore for this DB, with the name "statesdb"
|
||||
* Settings information for integration tests - test is based on the data used in
|
||||
* http://docs.geoserver.org/latest/en/user/data/database/sqlview.html#parameterizing-sql-views (states shapefile - available in
|
||||
* testdata/states.zip) - create a postgis db - import the states shapefile (using shp2pgsql or Postgis shapefile uploader) - In Geoserver, create
|
||||
* a postgis datastore for this DB, with the name "statesdb"
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
@ -313,7 +285,6 @@ public class GSFeatureEncoderTest extends GeoserverRESTTest {
|
||||
deleteAll();
|
||||
GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(RESTURL, RESTUSER, RESTPW);
|
||||
|
||||
|
||||
String storeName = "statesdb"; // name of the datastore setup for tests
|
||||
String layerName = "my_sqlviewlayer";
|
||||
String nativeName = "popstates";
|
||||
|
||||
@ -29,9 +29,11 @@ package it.geosolutions.geoserver.rest.publisher;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.ParameterConfigure;
|
||||
import it.geosolutions.geoserver.rest.GeoserverRESTTest;
|
||||
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
|
||||
import it.geosolutions.geoserver.rest.decoder.about.GSVersionDecoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
||||
import it.geosolutions.geoserver.rest.encoder.coverage.GSImageMosaicEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.dimensions.GSCoverageDimensionEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation;
|
||||
|
||||
@ -42,6 +44,7 @@ import java.io.IOException;
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
@ -105,6 +108,16 @@ public class GeoserverRESTImageMosaicTest extends GeoserverRESTTest {
|
||||
coverageEncoder.setSRS("EPSG:4326");
|
||||
coverageEncoder.setSUGGESTED_TILE_SIZE("256,256");
|
||||
coverageEncoder.setUSE_JAI_IMAGEREAD(true);
|
||||
|
||||
GSVersionDecoder v=reader.getGeoserverVersion();
|
||||
if (v.getVersion().equals(GSVersionDecoder.VERSION.getVersion(GSVersionDecoder.VERSION.v24.toString()))){
|
||||
// New style dimensions (since gs-2.4.x)
|
||||
GSCoverageDimensionEncoder gsCoverageDimensionEncoder = new GSCoverageDimensionEncoder(
|
||||
"GRAY_INDEX", "GridSampleDimension[-Infinity,Infinity]", "-inf", "inf",
|
||||
"dobson units³", "REAL_32BITS");
|
||||
coverageEncoder.addCoverageDimensionInfo(gsCoverageDimensionEncoder);
|
||||
} else {
|
||||
// Old stile setting code
|
||||
// activate time
|
||||
final GSDimensionInfoEncoder time=new GSDimensionInfoEncoder(true);
|
||||
time.setPresentation(Presentation.LIST);
|
||||
@ -112,6 +125,9 @@ public class GeoserverRESTImageMosaicTest extends GeoserverRESTTest {
|
||||
coverageEncoder.setMetadata("time", time);
|
||||
// not active elevation
|
||||
coverageEncoder.setMetadata("elevation", new GSDimensionInfoEncoder());
|
||||
}
|
||||
|
||||
|
||||
|
||||
assertTrue(publisher.createWorkspace(wsName));
|
||||
|
||||
|
||||
10
src/test/resources/testdata/coverageExample.xml
vendored
10
src/test/resources/testdata/coverageExample.xml
vendored
@ -1,4 +1,3 @@
|
||||
|
||||
<coverage>
|
||||
<name>granuleTestMosaic</name>
|
||||
<nativeName>granuleTestMosaic</nativeName>
|
||||
@ -27,15 +26,18 @@
|
||||
</metadataLink>
|
||||
</metadataLinks>
|
||||
<nativeCRS>GEOGCS["WGS 84", 
|
||||
DATUM["World Geodetic System 1984", 
|
||||
SPHEROID["WGS 84", 6378137.0, 298.257223563,
|
||||
DATUM["World Geodetic
|
||||
System 1984", 
|
||||
SPHEROID["WGS 84", 6378137.0,
|
||||
298.257223563,
|
||||
AUTHORITY["EPSG","7030"]], 
|
||||
AUTHORITY["EPSG","6326"]], 
|
||||
PRIMEM["Greenwich", 0.0,
|
||||
AUTHORITY["EPSG","8901"]], 
|
||||
UNIT["degree", 0.017453292519943295], 
|
||||
AXIS["Geodetic longitude", EAST], 
|
||||
AXIS["Geodetic latitude", NORTH], 
|
||||
AXIS["Geodetic
|
||||
latitude", NORTH], 
|
||||
AUTHORITY["EPSG","4326"]]</nativeCRS>
|
||||
<srs>EPSG:4326</srs>
|
||||
<nativeBoundingBox>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user