@Test public void testGetTemplate() { final Configuration configuration = new Configuration(); Map<String, Template> templates = new HashMap<>(); final Template t1Template = new Template(); templates.put("t1", t1Template); configuration.setTemplates(templates); assertEquals(t1Template, configuration.getTemplate("t1")); assertEquals(1, configuration.getTemplates().size()); assertEquals(t1Template, configuration.getTemplates().values().iterator().next()); assertNull(configuration.getTemplate("Doesn't exist")); }
public final Template getTemplate(final String name) { final Template template = this.templates.get(name); if (template != null) { this.accessAssertion.assertAccess("Configuration", this); template.assertAccessible(name); } else { LOGGER.warn("Template '%s' does not exist. Options are: %s", name, this.templates.keySet()); } return template; }
Configuration implements ConfigurationObject { public final Template getTemplate(final String name) { final Template template = this.templates.get(name); if (template != null) { this.accessAssertion.assertAccess("Configuration", this); template.assertAccessible(name); } else { LOGGER.warn("Template '%s' does not exist. Options are: %s", name, this.templates.keySet()); } return template; } }
Configuration implements ConfigurationObject { public final Template getTemplate(final String name) { final Template template = this.templates.get(name); if (template != null) { this.accessAssertion.assertAccess("Configuration", this); template.assertAccessible(name); } else { LOGGER.warn("Template '%s' does not exist. Options are: %s", name, this.templates.keySet()); } return template; }  }
Configuration implements ConfigurationObject { public final Template getTemplate(final String name) { final Template template = this.templates.get(name); if (template != null) { this.accessAssertion.assertAccess("Configuration", this); template.assertAccessible(name); } else { LOGGER.warn("Template '%s' does not exist. Options are: %s", name, this.templates.keySet()); } return template; }  final void setPdfConfig(final PDFConfig pdfConfig); @PostConstruct final void init(); final boolean renderAsSvg(final Boolean renderAsSvg); final void setDefaultToSvg(final boolean defaultToSvg); @Nullable final CertificateStore getCertificateStore(); final void setCertificateStore(final CertificateStore certificateStore); final List<HttpCredential> getCredentials(); final void setCredentials(final List<HttpCredential> credentials); final List<HttpProxy> getProxies(); final void setProxies(final List<HttpProxy> proxies); final void printClientConfig(final JSONWriter json); final String getOutputFilename(); final void setOutputFilename(final String outputFilename); final Map<String, Template> getTemplates(); final void setTemplates(final Map<String, Template> templates); final Template getTemplate(final String name); final File getDirectory(); final void setConfigurationFile(final File configurationFile); final void setStyles(final Map<String, String> styles); final Optional<? extends Style> getStyle(final String styleName); @Nonnull final Style getDefaultStyle(@Nonnull final String geometryType); final void setDefaultStyle(final Map<String, Style> defaultStyle); final boolean isThrowErrorOnExtraParameters(); final void setThrowErrorOnExtraParameters(final boolean throwErrorOnExtraParameters); @Override void validate(final List<Throwable> validationErrors, final Configuration configuration); final List<Throwable> validate(); final boolean isAccessible(final String pathToSubResource); final byte[] loadFile(final String pathToSubResource); final void setFileLoaderManager(final ConfigFileLoaderManager fileLoaderManager); final void setJdbcDrivers(final Set<String> jdbcDrivers); final void setAccess(final List<String> access); final AccessAssertion getAccessAssertion(); final String getTransparentTileErrorColor(); final void setTransparentTileErrorColor(final String transparentTileErrorColor); final String getOpaqueTileErrorColor(); final void setOpaqueTileErrorColor(final String opaqueTileErrorColor); final String getResourceBundle(); final void setResourceBundle(final String resourceBundle); final UriMatchers getAllowedReferersImpl(); final void setAllowedReferers(@Nullable final List<? extends URIMatcher> matchers); SmtpConfig getSmtp(); void setSmtp(final SmtpConfig smtp); }
Configuration implements ConfigurationObject { public final Template getTemplate(final String name) { final Template template = this.templates.get(name); if (template != null) { this.accessAssertion.assertAccess("Configuration", this); template.assertAccessible(name); } else { LOGGER.warn("Template '%s' does not exist. Options are: %s", name, this.templates.keySet()); } return template; }  final void setPdfConfig(final PDFConfig pdfConfig); @PostConstruct final void init(); final boolean renderAsSvg(final Boolean renderAsSvg); final void setDefaultToSvg(final boolean defaultToSvg); @Nullable final CertificateStore getCertificateStore(); final void setCertificateStore(final CertificateStore certificateStore); final List<HttpCredential> getCredentials(); final void setCredentials(final List<HttpCredential> credentials); final List<HttpProxy> getProxies(); final void setProxies(final List<HttpProxy> proxies); final void printClientConfig(final JSONWriter json); final String getOutputFilename(); final void setOutputFilename(final String outputFilename); final Map<String, Template> getTemplates(); final void setTemplates(final Map<String, Template> templates); final Template getTemplate(final String name); final File getDirectory(); final void setConfigurationFile(final File configurationFile); final void setStyles(final Map<String, String> styles); final Optional<? extends Style> getStyle(final String styleName); @Nonnull final Style getDefaultStyle(@Nonnull final String geometryType); final void setDefaultStyle(final Map<String, Style> defaultStyle); final boolean isThrowErrorOnExtraParameters(); final void setThrowErrorOnExtraParameters(final boolean throwErrorOnExtraParameters); @Override void validate(final List<Throwable> validationErrors, final Configuration configuration); final List<Throwable> validate(); final boolean isAccessible(final String pathToSubResource); final byte[] loadFile(final String pathToSubResource); final void setFileLoaderManager(final ConfigFileLoaderManager fileLoaderManager); final void setJdbcDrivers(final Set<String> jdbcDrivers); final void setAccess(final List<String> access); final AccessAssertion getAccessAssertion(); final String getTransparentTileErrorColor(); final void setTransparentTileErrorColor(final String transparentTileErrorColor); final String getOpaqueTileErrorColor(); final void setOpaqueTileErrorColor(final String opaqueTileErrorColor); final String getResourceBundle(); final void setResourceBundle(final String resourceBundle); final UriMatchers getAllowedReferersImpl(); final void setAllowedReferers(@Nullable final List<? extends URIMatcher> matchers); SmtpConfig getSmtp(); void setSmtp(final SmtpConfig smtp);  }