Added tests for publish and update style methods that use the raw format param

Conflicts:
	src/test/java/it/geosolutions/geoserver/rest/publisher/GeoserverRESTStyleTest.java
This commit is contained in:
andypower 2015-03-26 16:40:21 +01:00
parent e04dd7428e
commit 6327f699ff
2 changed files with 410 additions and 354 deletions

View File

@ -79,6 +79,15 @@ public class GeoserverRESTStyleTest extends GeoserverRESTTest {
assertFalse(publisher.publishStyle(sldFile));
assertTrue(reader.existsStyle(STYLENAME));
final String STYLENAMEV110 = "restteststyleV110";
File sldFileV110 = new ClassPathResource("testdata/" + STYLENAMEV110 + ".sld")
.getFile();
assertTrue(publisher.publishStyle(sldFileV110, STYLENAMEV110, true));
assertTrue(reader.existsStyle(STYLENAME));
assertFalse(publisher.publishStyle(sldFileV110, STYLENAMEV110, true));
RESTStyle style = reader.getStyle(STYLENAME);
assertEquals(STYLENAME, style.getName());
assertNull(style.getWorkspace());
@ -134,8 +143,13 @@ public class GeoserverRESTStyleTest extends GeoserverRESTTest {
File sldFile = new ClassPathResource("testdata/restteststyle.sld")
.getFile();
final String STYLENAMEV110 = "restteststyleV110";
File sldFileV110 = new ClassPathResource("testdata/" + STYLENAMEV110 + ".sld")
.getFile();
// known state?
cleanupTestStyle(styleName);
cleanupTestStyle(STYLENAMEV110);
// test insert
boolean published = publisher.publishStyle(sldFile); // Will take the
@ -152,6 +166,19 @@ public class GeoserverRESTStyleTest extends GeoserverRESTTest {
boolean ok = publisher.removeStyle(styleName);
assertTrue("Unpublish() failed", ok);
assertFalse(reader.existsStyle(styleName));
published = publisher.publishStyle(sldFileV110, STYLENAMEV110, true);
assertTrue("publish() failed", published);
assertTrue(reader.existsStyle(STYLENAMEV110));
boolean updated = publisher.updateStyle(sldFileV110, STYLENAMEV110, true);
assertTrue("update() failed", updated);
// test delete
ok = publisher.removeStyle(STYLENAMEV110);
assertTrue("Unpublish() failed", ok);
assertFalse(reader.existsStyle(STYLENAMEV110));
}
@Test

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:se="http://www.opengis.net/se" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd">
<NamedLayer>
<se:Name>OCEANSEA_1M:Foundation</se:Name>
<UserStyle>
<se:Name>GEOSYM</se:Name>
<IsDefault>1</IsDefault>
<se:FeatureTypeStyle>
<se:FeatureTypeName>Foundation</se:FeatureTypeName>
<se:Rule>
<se:Name>main</se:Name>
<se:PolygonSymbolizer uom="http://www.opengis.net/sld/units/pixel">
<se:Name>MySymbol</se:Name>
<se:Description>
<se:Title>Example Symbol</se:Title>
<se:Abstract>This is just a simple example.</se:Abstract>
</se:Description>
<se:Geometry>
<ogc:PropertyName>GEOMETRY</ogc:PropertyName>
</se:Geometry>
<se:Fill>
<se:SvgParameter name="fill">#96C3F5</se:SvgParameter>
</se:Fill>
</se:PolygonSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>