Merge 4bbfd08c0d into d518e9e5a4
This commit is contained in:
commit
dd1dc5537b
@ -130,14 +130,22 @@ public class RESTLayerGroup {
|
||||
}
|
||||
}
|
||||
|
||||
public RESTPublishedList getPublishedList() {
|
||||
if (rootElem.getChild("publishables") != null) {
|
||||
return new RESTPublishedList(rootElem.getChild("publishables"));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public RESTPublishedList getPublishedList() {
|
||||
if (rootElem.getChild("publishables") != null) {
|
||||
return new RESTPublishedList(rootElem.getChild("publishables"));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public RESTStyleList getStyleList() {
|
||||
if (rootElem.getChild("styles") != null) {
|
||||
return new RESTStyleList(rootElem.getChild("styles"));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getCRS() {
|
||||
Element bounds = rootElem.getChild("bounds");
|
||||
return bounds.getChildText("crs");
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package it.geosolutions.geoserver.rest.decoder;
|
||||
|
||||
import it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RESTLayerGroupTest {
|
||||
|
||||
@Test
|
||||
public void parseLayerGroup() throws IOException{
|
||||
InputStream is = RESTFeatureTypeListTest.class.getResourceAsStream("/testdata/layergroups.xml");
|
||||
String response = IOUtils.toString(is);
|
||||
RESTLayerGroup lg = RESTLayerGroup.build(response);
|
||||
|
||||
String[] expected_layers=new String[]{
|
||||
"layer001",
|
||||
"layer002",
|
||||
"layer003",
|
||||
"geo:lg001",
|
||||
"geo:lg002"
|
||||
};
|
||||
|
||||
String[] expected_styles=new String[]{
|
||||
"grass",
|
||||
null,
|
||||
"raster",
|
||||
null,
|
||||
null
|
||||
};
|
||||
|
||||
|
||||
RESTPublishedList children = lg.getPublishedList();
|
||||
RESTStyleList styles = lg.getStyleList();
|
||||
|
||||
for (int i=0;i<children.size();i++){
|
||||
RESTPublished child = children.get(i);
|
||||
NameLinkElem style = styles.get(i);
|
||||
Assert.assertEquals(child.getName(), expected_layers[i]);
|
||||
Assert.assertEquals(style.getName(), expected_styles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
src/test/resources/testdata/layergroups.xml
vendored
Normal file
47
src/test/resources/testdata/layergroups.xml
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
<layerGroup>
|
||||
<name>lg003</name>
|
||||
<mode>SINGLE</mode>
|
||||
<workspace>
|
||||
<name>geo</name>
|
||||
</workspace>
|
||||
<publishables>
|
||||
<published type="layer">
|
||||
<name>layer001</name>
|
||||
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost/geoserver/rest/layers/layer001.xml" type="application/xml"/>
|
||||
</published>
|
||||
<published type="layer">
|
||||
<name>layer002</name>
|
||||
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost/geoserver/rest/layers/layer002.xml" type="application/xml"/>
|
||||
</published>
|
||||
<published type="layer">
|
||||
<name>layer003</name>
|
||||
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost/geoserver/rest/layers/layer003.xml" type="application/xml"/>
|
||||
</published>
|
||||
<published type="layerGroup">
|
||||
<name>geo:lg001</name>
|
||||
</published>
|
||||
<published type="layerGroup">
|
||||
<name>geo:lg002</name>
|
||||
</published>
|
||||
</publishables>
|
||||
<styles>
|
||||
<style>
|
||||
<name>grass</name>
|
||||
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost/geoserver/rest/styles/grass.xml" type="application/xml"/>
|
||||
</style>
|
||||
<style/>
|
||||
<style>
|
||||
<name>raster</name>
|
||||
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost/geoserver/rest/styles/raster.xml" type="application/xml"/>
|
||||
</style>
|
||||
<style/>
|
||||
<style/>
|
||||
</styles>
|
||||
<bounds>
|
||||
<minx>-2.00375083428E7</minx>
|
||||
<maxx>2.00375083428E7</maxx>
|
||||
<miny>-2.00375083428E7</miny>
|
||||
<maxy>2.00375083428E7</maxy>
|
||||
<crs class="projected">EPSG:3857</crs>
|
||||
</bounds>
|
||||
</layerGroup>
|
||||
Loading…
Reference in New Issue
Block a user