use of org.xwiki.configuration.ConfigurationSource in project xwiki-platform by xwiki.
the class DefaultMailSenderConfigurationTest method usesAuthenticationWhenNoUserNameAndPassword.
@Test
public void usesAuthenticationWhenNoUserNameAndPassword() throws Exception {
ConfigurationSource documentsSource = this.mocker.getInstance(ConfigurationSource.class, "documents");
when(documentsSource.getProperty("smtp_server_username", (String) null)).thenReturn(null);
when(documentsSource.getProperty("smtp_server_password", (String) null)).thenReturn(null);
assertFalse(this.mocker.getComponentUnderTest().usesAuthentication());
}
use of org.xwiki.configuration.ConfigurationSource in project xwiki-platform by xwiki.
the class DefaultMailSenderConfigurationTest method getBCCAddressesFromMailConfig.
@Test
public void getBCCAddressesFromMailConfig() throws Exception {
ConfigurationSource mailConfigDocumentSource = this.mocker.getInstance(ConfigurationSource.class, "mailsend");
when(mailConfigDocumentSource.getProperty("bcc", String.class)).thenReturn("john@doe.com, mary@doe.com");
assertThat(Arrays.asList("john@doe.com", "mary@doe.com"), containsInAnyOrder(this.mocker.getComponentUnderTest().getBCCAddresses().toArray()));
}
use of org.xwiki.configuration.ConfigurationSource in project xwiki-platform by xwiki.
the class DefaultMailSenderConfigurationTest method getPortFromXWikiPreferences.
@Test
public void getPortFromXWikiPreferences() throws Exception {
ConfigurationSource documentsSource = this.mocker.getInstance(ConfigurationSource.class, "documents");
when(documentsSource.getProperty("smtp_port")).thenReturn("25");
ConfigurationSource mailConfigDocumentSource = this.mocker.getInstance(ConfigurationSource.class, "mailsend");
when(mailConfigDocumentSource.getProperty("port", 25)).thenReturn(25);
assertEquals(25, this.mocker.getComponentUnderTest().getPort());
}
use of org.xwiki.configuration.ConfigurationSource in project xwiki-platform by xwiki.
the class DefaultMailSenderConfigurationTest method getPortWhenMailConfigDoesntExist.
@Test
public void getPortWhenMailConfigDoesntExist() throws Exception {
ConfigurationSource xwikiPropertiesSource = this.mocker.getInstance(ConfigurationSource.class, "xwikiproperties");
when(xwikiPropertiesSource.getProperty("mail.sender.port", 25)).thenReturn(25);
assertEquals(25, this.mocker.getComponentUnderTest().getPort());
}
use of org.xwiki.configuration.ConfigurationSource in project xwiki-platform by xwiki.
the class DefaultMailSenderConfigurationTest method getFromAddressWhenDefinedInMailConfig.
@Test
public void getFromAddressWhenDefinedInMailConfig() throws Exception {
ConfigurationSource documentsSource = this.mocker.getInstance(ConfigurationSource.class, "documents");
when(documentsSource.getProperty("admin_email", String.class)).thenReturn(null);
ConfigurationSource mailConfigDocumentSource = this.mocker.getInstance(ConfigurationSource.class, "mailsend");
when(mailConfigDocumentSource.getProperty("from", (String) null)).thenReturn("john@doe.com");
assertEquals("john@doe.com", this.mocker.getComponentUnderTest().getFromAddress());
}
Aggregations