use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.
the class WebDavStoreTest method getPersonalNamespaces_shouldProvideListOfAllFoldersSentFromResponses.
@Test
public void getPersonalNamespaces_shouldProvideListOfAllFoldersSentFromResponses() throws Exception {
StoreConfig storeConfig = createStoreConfig("webdav://user:password@example.org:80");
WebDavStore webDavStore = new WebDavStore(storeConfig, mockHttpClientFactory);
configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(), createOkSearchResponse());
List<? extends Folder> folders = webDavStore.getPersonalNamespaces(true);
List<HttpGeneric> requests = requestCaptor.getAllValues();
assertEquals(3, folders.size());
}
use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.
the class SmtpTransportTest method SmtpTransport_withValidTransportUri.
@Test
public void SmtpTransport_withValidTransportUri() throws Exception {
StoreConfig storeConfig = createStoreConfigWithTransportUri("smtp://user:password:CRAM_MD5@server:123456");
new SmtpTransport(storeConfig, socketFactory, oAuth2TokenProvider);
}
use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.
the class RemoteStore method getInstance.
/**
* Get an instance of a remote mail store.
*/
public static synchronized Store getInstance(Context context, StoreConfig storeConfig) throws MessagingException {
String uri = storeConfig.getStoreUri();
if (uri.startsWith("local")) {
throw new RuntimeException("Asked to get non-local Store object but given LocalStore URI");
}
Store store = sStores.get(uri);
if (store == null) {
if (uri.startsWith("imap")) {
OAuth2TokenProvider oAuth2TokenProvider = null;
store = new ImapStore(storeConfig, new DefaultTrustedSocketFactory(context), (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE), oAuth2TokenProvider);
} else if (uri.startsWith("pop3")) {
store = new Pop3Store(storeConfig, new DefaultTrustedSocketFactory(context));
} else if (uri.startsWith("webdav")) {
store = new WebDavStore(storeConfig, new WebDavHttpClient.WebDavHttpClientFactory());
}
if (store != null) {
sStores.put(uri, store);
}
}
if (store == null) {
throw new MessagingException("Unable to locate an applicable Store for " + uri);
}
return store;
}
use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.
the class ImapPusherTest method getRefreshInterval.
@Test
public void getRefreshInterval() throws Exception {
StoreConfig storeConfig = mock(StoreConfig.class);
when(storeConfig.getIdleRefreshMinutes()).thenReturn(23);
when(imapStore.getStoreConfig()).thenReturn(storeConfig);
int result = imapPusher.getRefreshInterval();
assertEquals(23 * 60 * 1000, result);
}
use of com.fsck.k9.mail.store.StoreConfig in project k-9 by k9mail.
the class SmtpTransportTest method createStoreConfigWithTransportUri.
private StoreConfig createStoreConfigWithTransportUri(String value) {
StoreConfig storeConfig = mock(StoreConfig.class);
when(storeConfig.getTransportUri()).thenReturn(value);
return storeConfig;
}
Aggregations