Unverified Commit 8ca5943c authored by Nuno Oliveira's avatar Nuno Oliveira Committed by GitHub
Browse files

[GEOS-9101] Complex MongoDB generated properties are not correctly handlded in SLDs (#3326)

parent 2ba7d881
......@@ -4,10 +4,6 @@
*/
package org.geoserver.test.onlineTest;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeTrue;
import com.mongodb.BasicDBObject;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
......@@ -47,8 +43,11 @@ import org.geoserver.util.IOUtils;
import org.geotools.feature.NameImpl;
import org.geotools.image.test.ImageAssert;
import org.geotools.util.URLs;
import static org.hamcrest.CoreMatchers.is;
import org.hamcrest.MatcherAssert;
import org.junit.AfterClass;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeTrue;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletResponse;
......@@ -147,6 +146,8 @@ public abstract class ComplexMongoDBSupport extends GeoServerSystemTestSupport {
dataStore.setWorkspace(workspace);
dataStore.setEnabled(true);
catalog.add(dataStore);
// add the stations style and set it as the default one for stations layer
testData.addStyle("stations", "stations.sld", ComplexMongoDBSupport.class, catalog);
// build the feature type for the root mapping (StationFeature)
CatalogBuilder builder = new CatalogBuilder(catalog);
builder.setStore(dataStore);
......@@ -155,7 +156,7 @@ public abstract class ComplexMongoDBSupport extends GeoServerSystemTestSupport {
builder.buildFeatureType(new NameImpl(nameSpace.getURI(), "StationFeature"));
catalog.add(featureType);
LayerInfo layer = builder.buildLayer(featureType);
layer.setDefaultStyle(catalog.getStyleByName("point"));
layer.setDefaultStyle(catalog.getStyleByName("stations"));
catalog.add(layer);
}
......
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:st="http://www.stations.org/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>certain</Name>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<Filter>
<PropertyIsEqualTo>
<PropertyName>st:measurement/st:Measurement/st:values/st:Value/st:value</PropertyName>
<Literal>1015</Literal>
</PropertyIsEqualTo>
</Filter>
<Name>certain</Name>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</Mark>
<Size>5</Size>
</Graphic>
</PointSymbolizer>
<TextSymbolizer>
<Label>
<PropertyName>st:name</PropertyName>
</Label>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment