Remove unused parameter
This commit is contained in:
parent
b35074315c
commit
87132562f8
15 changed files with 33 additions and 54 deletions
|
@ -423,7 +423,7 @@ public class MessagingController {
|
|||
List<LocalFolder> localFolders = null;
|
||||
try {
|
||||
Backend backend = getBackend(account);
|
||||
List<FolderInfo> folders = backend.getFolders(false);
|
||||
List<FolderInfo> folders = backend.getFolders();
|
||||
|
||||
LocalStore localStore = account.getLocalStore();
|
||||
Map<String, String> remoteFolderNameMap = new HashMap<>();
|
||||
|
|
|
@ -251,7 +251,7 @@ public class MessagingControllerTest extends K9RobolectricTest {
|
|||
public void refreshRemoteSynchronous_shouldCreateFoldersFromRemote() throws MessagingException {
|
||||
FolderInfo remoteFolderInfo = new FolderInfo("NewFolder", "Folder Name");
|
||||
List<FolderInfo> folderInfoList = Collections.singletonList(remoteFolderInfo);
|
||||
when(backend.getFolders(false)).thenAnswer(createAnswer(folderInfoList));
|
||||
when(backend.getFolders()).thenAnswer(createAnswer(folderInfoList));
|
||||
LocalFolder newLocalFolder = mock(LocalFolder.class);
|
||||
when(localStore.getFolder("NewFolder")).thenReturn(newLocalFolder);
|
||||
|
||||
|
@ -266,7 +266,7 @@ public class MessagingControllerTest extends K9RobolectricTest {
|
|||
when(oldLocalFolder.getServerId()).thenReturn("OldLocalFolder");
|
||||
when(localStore.getPersonalNamespaces(false)).thenReturn(Collections.singletonList(oldLocalFolder));
|
||||
List<FolderInfo> folderInfoList = Collections.emptyList();
|
||||
when(backend.getFolders(false)).thenAnswer(createAnswer(folderInfoList));
|
||||
when(backend.getFolders()).thenAnswer(createAnswer(folderInfoList));
|
||||
|
||||
controller.refreshRemoteSynchronous(account, listener);
|
||||
|
||||
|
@ -291,7 +291,7 @@ public class MessagingControllerTest extends K9RobolectricTest {
|
|||
when(localStore.getPersonalNamespaces(false))
|
||||
.thenReturn(Collections.singletonList(missingSpecialFolder));
|
||||
List<FolderInfo> folderInfoList = Collections.emptyList();
|
||||
when(backend.getFolders(false)).thenAnswer(createAnswer(folderInfoList));
|
||||
when(backend.getFolders()).thenAnswer(createAnswer(folderInfoList));
|
||||
|
||||
controller.refreshRemoteSynchronous(account, listener);
|
||||
|
||||
|
@ -631,7 +631,7 @@ public class MessagingControllerTest extends K9RobolectricTest {
|
|||
private void configureBackendWithFolder() throws MessagingException {
|
||||
FolderInfo remoteFolderInfo = new FolderInfo(FOLDER_NAME, FOLDER_NAME);
|
||||
List<FolderInfo> folderInfoList = Collections.singletonList(remoteFolderInfo);
|
||||
when(backend.getFolders(false)).thenAnswer(createAnswer(folderInfoList));
|
||||
when(backend.getFolders()).thenAnswer(createAnswer(folderInfoList));
|
||||
}
|
||||
|
||||
private void setAccountsInPreferences(Map<String, Account> newAccounts)
|
||||
|
|
|
@ -22,7 +22,7 @@ interface Backend {
|
|||
val isPushCapable: Boolean
|
||||
|
||||
@Throws(MessagingException::class)
|
||||
fun getFolders(forceListAll: Boolean): List<FolderInfo>
|
||||
fun getFolders(): List<FolderInfo>
|
||||
|
||||
// TODO: Add a way to cancel the sync process
|
||||
fun sync(folder: String, syncConfig: SyncConfig, listener: SyncListener, providedRemoteFolder: Folder<*>?)
|
||||
|
|
|
@ -6,8 +6,8 @@ import com.fsck.k9.mail.store.imap.ImapStore
|
|||
|
||||
|
||||
internal class CommandGetFolders(private val imapStore: ImapStore) {
|
||||
fun getFolders(forceListAll: Boolean): List<FolderInfo> {
|
||||
return imapStore.getPersonalNamespaces(forceListAll).map {
|
||||
fun getFolders(): List<FolderInfo> {
|
||||
return imapStore.personalNamespaces.map {
|
||||
FolderInfo(it.serverId, it.name)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,8 +100,8 @@ public class ImapBackend implements Backend {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<FolderInfo> getFolders(boolean forceListAll) {
|
||||
return commandGetFolders.getFolders(forceListAll);
|
||||
public List<FolderInfo> getFolders() {
|
||||
return commandGetFolders.getFolders();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,7 +36,7 @@ class Pop3Backend(
|
|||
override val supportsSearchByDate = false
|
||||
override val isPushCapable = false
|
||||
|
||||
override fun getFolders(forceListAll: Boolean): List<FolderInfo> {
|
||||
override fun getFolders(): List<FolderInfo> {
|
||||
return commandGetFolders.getFolders()
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import com.fsck.k9.mail.store.webdav.WebDavStore
|
|||
|
||||
|
||||
internal class CommandGetFolders(private val webDavStore: WebDavStore) {
|
||||
fun getFolders(forceListAll: Boolean): List<FolderInfo> {
|
||||
return webDavStore.getPersonalNamespaces(forceListAll).map {
|
||||
fun getFolders(): List<FolderInfo> {
|
||||
return webDavStore.personalNamespaces.map {
|
||||
FolderInfo(it.serverId, it.name)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ class WebDavBackend(
|
|||
override val supportsSearchByDate = false
|
||||
override val isPushCapable = false
|
||||
|
||||
override fun getFolders(forceListAll: Boolean): List<FolderInfo> {
|
||||
return commandGetFolders.getFolders(forceListAll)
|
||||
override fun getFolders(): List<FolderInfo> {
|
||||
return commandGetFolders.getFolders()
|
||||
}
|
||||
|
||||
override fun sync(folder: String, syncConfig: SyncConfig, listener: SyncListener, providedRemoteFolder: Folder<*>?) {
|
||||
|
|
|
@ -6,8 +6,6 @@ import java.util.List;
|
|||
import com.fsck.k9.mail.Folder;
|
||||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mail.PushReceiver;
|
||||
import com.fsck.k9.mail.Pusher;
|
||||
import com.fsck.k9.mail.ssl.TrustedSocketFactory;
|
||||
|
||||
|
||||
|
@ -26,7 +24,7 @@ public abstract class RemoteStore {
|
|||
|
||||
public abstract Folder<? extends Message> getFolder(String name);
|
||||
|
||||
public abstract List<? extends Folder > getPersonalNamespaces(boolean forceListAll) throws MessagingException;
|
||||
public abstract List<? extends Folder > getPersonalNamespaces() throws MessagingException;
|
||||
|
||||
public abstract void checkSettings() throws MessagingException;
|
||||
|
||||
|
|
|
@ -121,13 +121,13 @@ public class ImapStore extends RemoteStore {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ImapFolder> getPersonalNamespaces(boolean forceListAll) throws MessagingException {
|
||||
public List<ImapFolder> getPersonalNamespaces() throws MessagingException {
|
||||
ImapConnection connection = getConnection();
|
||||
|
||||
try {
|
||||
Set<String> folderNames = listFolders(connection, false);
|
||||
|
||||
if (forceListAll || !mStoreConfig.subscribedFoldersOnly()) {
|
||||
if (!mStoreConfig.subscribedFoldersOnly()) {
|
||||
return getFolders(folderNames);
|
||||
}
|
||||
|
||||
|
|
|
@ -161,26 +161,7 @@ public class ImapStoreTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getPersonalNamespaces_withForceListAll() throws Exception {
|
||||
when(storeConfig.subscribedFoldersOnly()).thenReturn(true);
|
||||
ImapConnection imapConnection = mock(ImapConnection.class);
|
||||
List<ImapResponse> imapResponses = Arrays.asList(
|
||||
createImapResponse("* LIST (\\HasNoChildren) \".\" \"INBOX\""),
|
||||
createImapResponse("* LIST (\\Noselect \\HasChildren) \".\" \"Folder\""),
|
||||
createImapResponse("* LIST (\\HasNoChildren) \".\" \"Folder.SubFolder\""),
|
||||
createImapResponse("6 OK Success")
|
||||
);
|
||||
when(imapConnection.executeSimpleCommand("LIST \"\" \"*\"")).thenReturn(imapResponses);
|
||||
imapStore.enqueueImapConnection(imapConnection);
|
||||
|
||||
List<? extends Folder> result = imapStore.getPersonalNamespaces(true);
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderNames(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonalNamespaces_withoutForceListAllAndWithoutSubscribedFoldersOnly() throws Exception {
|
||||
public void getPersonalNamespaces_withoutSubscribedFoldersOnly() throws Exception {
|
||||
when(storeConfig.subscribedFoldersOnly()).thenReturn(false);
|
||||
ImapConnection imapConnection = mock(ImapConnection.class);
|
||||
List<ImapResponse> imapResponses = Arrays.asList(
|
||||
|
@ -192,14 +173,14 @@ public class ImapStoreTest {
|
|||
when(imapConnection.executeSimpleCommand("LIST \"\" \"*\"")).thenReturn(imapResponses);
|
||||
imapStore.enqueueImapConnection(imapConnection);
|
||||
|
||||
List<? extends Folder> result = imapStore.getPersonalNamespaces(false);
|
||||
List<? extends Folder> result = imapStore.getPersonalNamespaces();
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderNames(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonalNamespaces_withSubscribedFoldersOnlyAndWithoutForceListAll_shouldOnlyReturnExistingSubscribedFolders()
|
||||
public void getPersonalNamespaces_withSubscribedFoldersOnly_shouldOnlyReturnExistingSubscribedFolders()
|
||||
throws Exception {
|
||||
when(storeConfig.subscribedFoldersOnly()).thenReturn(true);
|
||||
ImapConnection imapConnection = mock(ImapConnection.class);
|
||||
|
@ -220,7 +201,7 @@ public class ImapStoreTest {
|
|||
when(imapConnection.executeSimpleCommand("LIST \"\" \"*\"")).thenReturn(imapResponses);
|
||||
imapStore.enqueueImapConnection(imapConnection);
|
||||
|
||||
List<? extends Folder> result = imapStore.getPersonalNamespaces(false);
|
||||
List<? extends Folder> result = imapStore.getPersonalNamespaces();
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderNames(result));
|
||||
|
@ -239,7 +220,7 @@ public class ImapStoreTest {
|
|||
imapStore.enqueueImapConnection(imapConnection);
|
||||
imapStore.setTestCombinedPrefix("INBOX.");
|
||||
|
||||
List<ImapFolder> result = imapStore.getPersonalNamespaces(false);
|
||||
List<ImapFolder> result = imapStore.getPersonalNamespaces();
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(Sets.newSet("INBOX", "FolderOne", "FolderTwo"), extractFolderNames(result));
|
||||
|
@ -259,7 +240,7 @@ public class ImapStoreTest {
|
|||
imapStore.enqueueImapConnection(imapConnection);
|
||||
imapStore.setTestCombinedPrefix("INBOX.");
|
||||
|
||||
List<ImapFolder> result = imapStore.getPersonalNamespaces(false);
|
||||
List<ImapFolder> result = imapStore.getPersonalNamespaces();
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(Sets.newSet("INBOX", "FolderOne"), extractFolderNames(result));
|
||||
|
@ -272,7 +253,7 @@ public class ImapStoreTest {
|
|||
when(imapConnection.executeSimpleCommand(anyString())).thenReturn(imapResponses);
|
||||
imapStore.enqueueImapConnection(imapConnection);
|
||||
|
||||
imapStore.getPersonalNamespaces(true);
|
||||
imapStore.getPersonalNamespaces();
|
||||
|
||||
verify(imapConnection, never()).close();
|
||||
}
|
||||
|
@ -284,7 +265,7 @@ public class ImapStoreTest {
|
|||
imapStore.enqueueImapConnection(imapConnection);
|
||||
|
||||
try {
|
||||
imapStore.getPersonalNamespaces(true);
|
||||
imapStore.getPersonalNamespaces();
|
||||
fail("Expected exception");
|
||||
} catch (MessagingException ignored) {
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class Pop3Store extends RemoteStore {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pop3Folder> getPersonalNamespaces(boolean forceListAll) throws MessagingException {
|
||||
public List<Pop3Folder> getPersonalNamespaces() {
|
||||
List<Pop3Folder> folders = new LinkedList<>();
|
||||
folders.add(getFolder(Pop3Folder.INBOX));
|
||||
return folders;
|
||||
|
|
|
@ -90,7 +90,7 @@ public class Pop3StoreTest {
|
|||
|
||||
@Test
|
||||
public void getPersonalNamespace_shouldReturnListConsistingOfInbox() throws Exception {
|
||||
List<Pop3Folder> folders = store.getPersonalNamespaces(true);
|
||||
List<Pop3Folder> folders = store.getPersonalNamespaces();
|
||||
|
||||
assertEquals(1, folders.size());
|
||||
assertEquals("INBOX", folders.get(0).getServerId());
|
||||
|
|
|
@ -159,7 +159,7 @@ public class WebDavStore extends RemoteStore {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Folder> getPersonalNamespaces(boolean forceListAll) throws MessagingException {
|
||||
public List<? extends Folder> getPersonalNamespaces() throws MessagingException {
|
||||
List<Folder> folderList = new LinkedList<>();
|
||||
/*
|
||||
* We have to check authentication here so we have the proper URL stored
|
||||
|
|
|
@ -211,7 +211,7 @@ public class WebDavStoreTest {
|
|||
configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(),
|
||||
createOkSearchResponse());
|
||||
|
||||
webDavStore.getPersonalNamespaces(true);
|
||||
webDavStore.getPersonalNamespaces();
|
||||
|
||||
List<HttpGeneric> requests = requestCaptor.getAllValues();
|
||||
assertEquals(4, requests.size()); // AUTH + 2
|
||||
|
@ -223,7 +223,7 @@ public class WebDavStoreTest {
|
|||
configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(),
|
||||
createOkSearchResponse());
|
||||
|
||||
webDavStore.getPersonalNamespaces(true);
|
||||
webDavStore.getPersonalNamespaces();
|
||||
|
||||
verify(storeConfig).setInboxFolder("Inbox");
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ public class WebDavStoreTest {
|
|||
configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(),
|
||||
createOkSearchResponse());
|
||||
|
||||
webDavStore.getPersonalNamespaces(true);
|
||||
webDavStore.getPersonalNamespaces();
|
||||
|
||||
List<HttpGeneric> requests = requestCaptor.getAllValues();
|
||||
assertEquals(4, requests.size()); // AUTH + SPECIALFOLDERS + 1
|
||||
|
@ -245,7 +245,7 @@ public class WebDavStoreTest {
|
|||
configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(),
|
||||
createOkSearchResponse());
|
||||
|
||||
List<? extends Folder> folders = webDavStore.getPersonalNamespaces(true);
|
||||
List<? extends Folder> folders = webDavStore.getPersonalNamespaces();
|
||||
|
||||
List<HttpGeneric> requests = requestCaptor.getAllValues();
|
||||
|
||||
|
|
Loading…
Reference in a new issue