@Test public void getAdditionalPropertiesFromXWikiProperties() { Properties properties = new Properties(); properties.setProperty("key1", "value1"); properties.setProperty("key2", "value2"); when(this.xwikiPropertiesSource.getProperty("mail.sender.properties", Properties.class)).thenReturn(properties); Properties returnedProperties = this.configuration.getAdditionalProperties(); assertEquals("value1", returnedProperties.getProperty("key1")); assertEquals("value2", returnedProperties.getProperty("key2")); }
@Override public Properties getAdditionalProperties() { Properties properties; String extraPropertiesAsString = this.currentWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); if (extraPropertiesAsString == null && !isMainWiki()) { extraPropertiesAsString = this.mainWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); } if (extraPropertiesAsString == null) { properties = this.xwikiPropertiesSource.getProperty(PREFIX + PROPERTIES_PROPERTY, Properties.class); } else { InputStream is = new ByteArrayInputStream(extraPropertiesAsString.getBytes()); properties = new Properties(); try { properties.load(is); } catch (Exception e) { this.logger.warn("Error while parsing mail properties [{}]. Root cause [{}]. Ignoring configuration...", extraPropertiesAsString, ExceptionUtils.getRootCauseMessage(e)); } } return properties; }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAdditionalProperties() { Properties properties; String extraPropertiesAsString = this.currentWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); if (extraPropertiesAsString == null && !isMainWiki()) { extraPropertiesAsString = this.mainWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); } if (extraPropertiesAsString == null) { properties = this.xwikiPropertiesSource.getProperty(PREFIX + PROPERTIES_PROPERTY, Properties.class); } else { InputStream is = new ByteArrayInputStream(extraPropertiesAsString.getBytes()); properties = new Properties(); try { properties.load(is); } catch (Exception e) { this.logger.warn("Error while parsing mail properties [{}]. Root cause [{}]. Ignoring configuration...", extraPropertiesAsString, ExceptionUtils.getRootCauseMessage(e)); } } return properties; } }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAdditionalProperties() { Properties properties; String extraPropertiesAsString = this.currentWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); if (extraPropertiesAsString == null && !isMainWiki()) { extraPropertiesAsString = this.mainWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); } if (extraPropertiesAsString == null) { properties = this.xwikiPropertiesSource.getProperty(PREFIX + PROPERTIES_PROPERTY, Properties.class); } else { InputStream is = new ByteArrayInputStream(extraPropertiesAsString.getBytes()); properties = new Properties(); try { properties.load(is); } catch (Exception e) { this.logger.warn("Error while parsing mail properties [{}]. Root cause [{}]. Ignoring configuration...", extraPropertiesAsString, ExceptionUtils.getRootCauseMessage(e)); } } return properties; }  }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAdditionalProperties() { Properties properties; String extraPropertiesAsString = this.currentWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); if (extraPropertiesAsString == null && !isMainWiki()) { extraPropertiesAsString = this.mainWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); } if (extraPropertiesAsString == null) { properties = this.xwikiPropertiesSource.getProperty(PREFIX + PROPERTIES_PROPERTY, Properties.class); } else { InputStream is = new ByteArrayInputStream(extraPropertiesAsString.getBytes()); properties = new Properties(); try { properties.load(is); } catch (Exception e) { this.logger.warn("Error while parsing mail properties [{}]. Root cause [{}]. Ignoring configuration...", extraPropertiesAsString, ExceptionUtils.getRootCauseMessage(e)); } } return properties; }  @Override String getHost(); @Override int getPort(); @Override String getUsername(); @Override String getPassword(); @Override List<String> getBCCAddresses(); @Override String getFromAddress(); @Override Properties getAdditionalProperties(); @Override Properties getAllProperties(); @Override boolean usesAuthentication(); @Override String getScriptServicePermissionCheckerHint(); @Override long getSendWaitTime(); @Override int getPrepareQueueCapacity(); @Override int getSendQueueCapacity(); }
DefaultMailSenderConfiguration implements MailSenderConfiguration { @Override public Properties getAdditionalProperties() { Properties properties; String extraPropertiesAsString = this.currentWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); if (extraPropertiesAsString == null && !isMainWiki()) { extraPropertiesAsString = this.mainWikiMailConfigSource.getProperty(PROPERTIES_PROPERTY, String.class); } if (extraPropertiesAsString == null) { properties = this.xwikiPropertiesSource.getProperty(PREFIX + PROPERTIES_PROPERTY, Properties.class); } else { InputStream is = new ByteArrayInputStream(extraPropertiesAsString.getBytes()); properties = new Properties(); try { properties.load(is); } catch (Exception e) { this.logger.warn("Error while parsing mail properties [{}]. Root cause [{}]. Ignoring configuration...", extraPropertiesAsString, ExceptionUtils.getRootCauseMessage(e)); } } return properties; }  @Override String getHost(); @Override int getPort(); @Override String getUsername(); @Override String getPassword(); @Override List<String> getBCCAddresses(); @Override String getFromAddress(); @Override Properties getAdditionalProperties(); @Override Properties getAllProperties(); @Override boolean usesAuthentication(); @Override String getScriptServicePermissionCheckerHint(); @Override long getSendWaitTime(); @Override int getPrepareQueueCapacity(); @Override int getSendQueueCapacity(); static final String JAVAMAIL_TRANSPORT_PROTOCOL; static final String JAVAMAIL_SMTP_HOST; static final String JAVAMAIL_SMTP_PORT; static final String JAVAMAIL_SMTP_USERNAME; static final String JAVAMAIL_SMTP_AUTH; }