@SuppressWarnings("deprecation") @Test public void testV2ParseSymbolizersWithDefaultsAndValues() throws Throwable { final Style style = parseStyle("v2-style-symbolizers-default-values.json"); final List<FeatureTypeStyle> featureTypeStyles = style.featureTypeStyles(); assertEquals(1, featureTypeStyles.size()); final List<Rule> rules = featureTypeStyles.get(0).rules(); assertEquals(1, rules.size()); final Rule rule = rules.get(0); assertEquals(1000000, rule.getMaxScaleDenominator(), DELTA); assertEquals(100, rule.getMinScaleDenominator(), DELTA); final Filter filter = rule.getFilter(); assertTrue(filter instanceof PropertyIsLessThan); assertEquals("att < 3", ECQL.toCQL(filter)); assertEquals(2, rule.symbolizers().size()); PointSymbolizer symbolizer = (PointSymbolizer) rule.symbolizers().get(0); assertEquals(1, symbolizer.getGraphic().graphicalSymbols().size()); Mark mark = (Mark) symbolizer.getGraphic().graphicalSymbols().get(0); assertEquals("circle", valueOf(mark.getWellKnownName())); assertEquals(30, (Double) valueOf(symbolizer.getGraphic().getRotation()), DELTA); assertEquals(0.4, (Double) valueOf(symbolizer.getGraphic().getOpacity()), DELTA); assertEquals("#00FF00", valueOf(mark.getStroke().getColor())); LineSymbolizer lineSymbolizer = (LineSymbolizer) rule.symbolizers().get(1); assertNull(lineSymbolizer.getStroke().getDashArray()); }
@Override public Optional<Style> parseStyle( @Nullable final Configuration configuration, @Nonnull final ClientHttpRequestFactory clientHttpRequestFactory, @Nonnull final String styleString) { final Optional<Style> styleOptional = tryParse( configuration, styleString, clientHttpRequestFactory); if (styleOptional.isPresent()) { return styleOptional; } return ParserPluginUtils.loadStyleAsURI( clientHttpRequestFactory, styleString, (final byte[] input) -> { try { return tryParse( configuration, new String(input, Constants.DEFAULT_CHARSET), clientHttpRequestFactory); } catch (Throwable e) { throw ExceptionUtils.getRuntimeException(e); } }); }
MapfishStyleParserPlugin implements StyleParserPlugin { @Override public Optional<Style> parseStyle( @Nullable final Configuration configuration, @Nonnull final ClientHttpRequestFactory clientHttpRequestFactory, @Nonnull final String styleString) { final Optional<Style> styleOptional = tryParse( configuration, styleString, clientHttpRequestFactory); if (styleOptional.isPresent()) { return styleOptional; } return ParserPluginUtils.loadStyleAsURI( clientHttpRequestFactory, styleString, (final byte[] input) -> { try { return tryParse( configuration, new String(input, Constants.DEFAULT_CHARSET), clientHttpRequestFactory); } catch (Throwable e) { throw ExceptionUtils.getRuntimeException(e); } }); } }
MapfishStyleParserPlugin implements StyleParserPlugin { @Override public Optional<Style> parseStyle( @Nullable final Configuration configuration, @Nonnull final ClientHttpRequestFactory clientHttpRequestFactory, @Nonnull final String styleString) { final Optional<Style> styleOptional = tryParse( configuration, styleString, clientHttpRequestFactory); if (styleOptional.isPresent()) { return styleOptional; } return ParserPluginUtils.loadStyleAsURI( clientHttpRequestFactory, styleString, (final byte[] input) -> { try { return tryParse( configuration, new String(input, Constants.DEFAULT_CHARSET), clientHttpRequestFactory); } catch (Throwable e) { throw ExceptionUtils.getRuntimeException(e); } }); }  }
MapfishStyleParserPlugin implements StyleParserPlugin { @Override public Optional<Style> parseStyle( @Nullable final Configuration configuration, @Nonnull final ClientHttpRequestFactory clientHttpRequestFactory, @Nonnull final String styleString) { final Optional<Style> styleOptional = tryParse( configuration, styleString, clientHttpRequestFactory); if (styleOptional.isPresent()) { return styleOptional; } return ParserPluginUtils.loadStyleAsURI( clientHttpRequestFactory, styleString, (final byte[] input) -> { try { return tryParse( configuration, new String(input, Constants.DEFAULT_CHARSET), clientHttpRequestFactory); } catch (Throwable e) { throw ExceptionUtils.getRuntimeException(e); } }); }  @Override Optional<Style> parseStyle(
            @Nullable final Configuration configuration,
            @Nonnull final ClientHttpRequestFactory clientHttpRequestFactory,
            @Nonnull final String styleString); }
MapfishStyleParserPlugin implements StyleParserPlugin { @Override public Optional<Style> parseStyle( @Nullable final Configuration configuration, @Nonnull final ClientHttpRequestFactory clientHttpRequestFactory, @Nonnull final String styleString) { final Optional<Style> styleOptional = tryParse( configuration, styleString, clientHttpRequestFactory); if (styleOptional.isPresent()) { return styleOptional; } return ParserPluginUtils.loadStyleAsURI( clientHttpRequestFactory, styleString, (final byte[] input) -> { try { return tryParse( configuration, new String(input, Constants.DEFAULT_CHARSET), clientHttpRequestFactory); } catch (Throwable e) { throw ExceptionUtils.getRuntimeException(e); } }); }  @Override Optional<Style> parseStyle(
            @Nullable final Configuration configuration,
            @Nonnull final ClientHttpRequestFactory clientHttpRequestFactory,
            @Nonnull final String styleString);  }