Search in sources :

Example 6 with ServerSettings

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

the class ImapStoreUriTest method testDecodeStoreUriImapTLS.

@Test
public void testDecodeStoreUriImapTLS() {
    String uri = "imap+ssl+://PLAIN:user:pass@server/";
    ServerSettings settings = RemoteStore.decodeStoreUri(uri);
    assertEquals(ConnectionSecurity.SSL_TLS_REQUIRED, settings.connectionSecurity);
    assertEquals(AuthType.PLAIN, settings.authenticationType);
    assertEquals("user", settings.username);
    assertEquals("pass", settings.password);
    assertEquals("server", settings.host);
}
Also used : ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Example 7 with ServerSettings

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

the class ImapStoreUriTest method testDecodeStoreUriImapNoAuth.

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

Example 8 with ServerSettings

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

the class ImapStoreUriTest method testDecodeStoreUriImapNoPassword.

@Test
public void testDecodeStoreUriImapNoPassword() {
    String uri = "imap://user:@server/";
    ServerSettings settings = RemoteStore.decodeStoreUri(uri);
    assertEquals(AuthType.PLAIN, settings.authenticationType);
    assertEquals("user", settings.username);
    assertEquals(null, settings.password);
    assertEquals("server", settings.host);
}
Also used : ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Example 9 with ServerSettings

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

the class ImapStoreUriTest method testCreateStoreUriImapNoExtra.

@Test
public void testCreateStoreUriImapNoExtra() {
    ServerSettings settings = new ServerSettings(ServerSettings.Type.IMAP, "server", 143, ConnectionSecurity.NONE, AuthType.PLAIN, "user", "pass", null);
    String uri = RemoteStore.createStoreUri(settings);
    assertEquals("imap://PLAIN:user:pass@server:143/1%7C", uri);
}
Also used : ServerSettings(com.fsck.k9.mail.ServerSettings) Test(org.junit.Test)

Example 10 with ServerSettings

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

the class ImapStoreUriTest method testCreateStoreUriImapEmptyPrefix.

@Test
public void testCreateStoreUriImapEmptyPrefix() {
    Map<String, String> extra = new HashMap<String, String>();
    extra.put("autoDetectNamespace", "false");
    extra.put("pathPrefix", "");
    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%7C", uri);
}
Also used : HashMap(java.util.HashMap) 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