Search in sources :

Example 36 with ServerSettings

use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.

the class SmtpTransportUriTest method decodeUri_canDecodeTLS.

@Test
public void decodeUri_canDecodeTLS() {
    String storeUri = "smtp+tls+://user:password:PLAIN@server:123456";
    ServerSettings result = SmtpTransport.decodeUri(storeUri);
    assertEquals(ConnectionSecurity.STARTTLS_REQUIRED, result.connectionSecurity);
}
Also used : ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Example 37 with ServerSettings

use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.

the class SmtpTransportUriTest method createUri_canEncodeSmtpSslUri.

@Test
public void createUri_canEncodeSmtpSslUri() {
    ServerSettings serverSettings = new ServerSettings(ServerSettings.Type.SMTP, "server", 123456, ConnectionSecurity.SSL_TLS_REQUIRED, AuthType.EXTERNAL, "user", "password", "clientCert");
    String result = SmtpTransport.createUri(serverSettings);
    assertEquals("smtp+ssl+://user:clientCert:EXTERNAL@server:123456", result);
}
Also used : ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Example 38 with ServerSettings

use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.

the class SmtpTransportUriTest method createUri_canEncodeSmtpTlsUri.

@Test
public void createUri_canEncodeSmtpTlsUri() {
    ServerSettings serverSettings = new ServerSettings(ServerSettings.Type.SMTP, "server", 123456, ConnectionSecurity.STARTTLS_REQUIRED, AuthType.PLAIN, "user", "password", "clientCert");
    String result = SmtpTransport.createUri(serverSettings);
    assertEquals("smtp+tls+://user:password:PLAIN@server:123456", result);
}
Also used : ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Example 39 with ServerSettings

use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.

the class ImapStoreUriTest method testCreateStoreUriImapPrefix.

@Test
public void testCreateStoreUriImapPrefix() {
    Map<String, String> extra = new HashMap<String, String>();
    extra.put("autoDetectNamespace", "false");
    extra.put("pathPrefix", "customPathPrefix");
    ServerSettings settings = new ServerSettings(ServerSettings.Type.IMAP, "server", 143, ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null, extra);
    String uri = RemoteStore.createStoreUri(settings);
    assertEquals("imap://PLAIN:user:pass@server:143/0%7CcustomPathPrefix", uri);
}
Also used : HashMap(java.util.HashMap) ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Example 40 with ServerSettings

use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.

the class ImapStoreUriTest method testDecodeStoreUriImapNoExtras.

@Test
public void testDecodeStoreUriImapNoExtras() {
    String uri = "imap://PLAIN:user:pass@server:143/";
    ServerSettings settings = RemoteStore.decodeStoreUri(uri);
    assertEquals(AuthType.PLAIN, settings.authenticationType);
    assertEquals("user", settings.username);
    assertEquals("pass", settings.password);
    assertEquals("server", settings.host);
    assertEquals(143, settings.port);
    assertEquals("true", settings.getExtra().get("autoDetectNamespace"));
}
Also used : ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Aggregations

ServerSettings (com.fsck.k9.mail.ServerSettings)45 Test (org.junit.Test)34 URISyntaxException (java.net.URISyntaxException)9 AuthType (com.fsck.k9.mail.AuthType)8 URI (java.net.URI)7 HashMap (java.util.HashMap)5 ConnectionSecurity (com.fsck.k9.mail.ConnectionSecurity)4 InvalidSettingValueException (com.fsck.k9.preferences.Settings.InvalidSettingValueException)2 Map (java.util.Map)2 SharedPreferences (android.content.SharedPreferences)1 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)1 Account (com.fsck.k9.Account)1 Preferences (com.fsck.k9.Preferences)1 Store (com.fsck.k9.mail.Store)1 RemoteStore (com.fsck.k9.mail.store.RemoteStore)1 StoreConfig (com.fsck.k9.mail.store.StoreConfig)1 ImapStoreSettings (com.fsck.k9.mail.store.imap.ImapStoreSettings)1 WebDavStoreSettings (com.fsck.k9.mail.store.webdav.WebDavStoreSettings)1 SettingsDescription (com.fsck.k9.preferences.Settings.SettingsDescription)1 ArrayList (java.util.ArrayList)1