Remove more useless code
* Strike another blow for sanity! Change-Id: Id95b441f9577abda66f04113793d6b1c60500ebe
This commit is contained in:
parent
77160c8c08
commit
244d306ebb
|
@ -61,7 +61,7 @@ public abstract class Folder {
|
|||
* time and when close() is called. This is only used for remote stores - should be null
|
||||
* for LocalStore.LocalFolder.
|
||||
*/
|
||||
public abstract void open(OpenMode mode, PersistentDataCallbacks callbacks)
|
||||
public abstract void open(OpenMode mode)
|
||||
throws MessagingException;
|
||||
|
||||
/**
|
||||
|
@ -174,59 +174,12 @@ public abstract class Folder {
|
|||
public FolderRole getRole() {
|
||||
return FolderRole.UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will be called after the messaging controller has called
|
||||
* getPersonalNamespaces() and has created a matching LocalFolder object. This can
|
||||
* be used as a trigger for the folder to write back any folder-specific persistent data using
|
||||
* callbacks.
|
||||
*
|
||||
* This is not abstract because most folders do not require this functionality and do not
|
||||
* need to implement it.
|
||||
*/
|
||||
public void localFolderSetupComplete(Folder localFolder) {
|
||||
// Do nothing - return immediately
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an empty message of the appropriate type for the Folder.
|
||||
*/
|
||||
public abstract Message createMessage(String uid) throws MessagingException;
|
||||
|
||||
/**
|
||||
* Callback interface by which a Folder can read and write persistent data.
|
||||
* TODO This needs to be made more generic & flexible
|
||||
*/
|
||||
public interface PersistentDataCallbacks {
|
||||
|
||||
/**
|
||||
* Provides keyed storage of strings. Should be used for per-folder data. Do not use for
|
||||
* per-message data.
|
||||
* @param key identifier for the data (e.g. "sync.key" or "folder.id")
|
||||
* @param value Data to persist. All data must be encoded into a string,
|
||||
* so use base64 or some other encoding if necessary.
|
||||
*/
|
||||
public void setPersistentString(String key, String value);
|
||||
|
||||
/**
|
||||
* @param key identifier for the data of interest
|
||||
* @return the data saved by the Folder, or defaultValue if never set.
|
||||
*/
|
||||
public String getPersistentString(String key, String defaultValue);
|
||||
|
||||
/**
|
||||
* In a single transaction: Set a key/value pair for the folder, and bulk set or clear
|
||||
* message flags. Typically used at the beginning or conclusion of a bulk sync operation.
|
||||
*
|
||||
* @param key if non-null, the transaction will set this folder persistent value
|
||||
* @param value the value that will be stored for the key
|
||||
* @param setFlags if non-null, flag(s) will be set for all messages in the folder
|
||||
* @param clearFlags if non-null, flag(s) will be cleared for all messages in the folder
|
||||
*/
|
||||
public void setPersistentStringAndMessageFlags(String key, String value,
|
||||
Flag[] setFlags, Flag[] clearFlags) throws MessagingException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback interface by which a folder can report UID changes caused by certain operations.
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public *** newInstance(com.android.emailcommon.provider.Account, android.content.Context, com.android.email.mail.Store$PersistentDataCallbacks);
|
||||
public *** newInstance(com.android.emailcommon.provider.Account, android.content.Context);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class android.content.SharedPreferences$Editor {
|
||||
|
|
|
@ -617,7 +617,7 @@ public class MessagingController implements Runnable {
|
|||
|
||||
Store remoteStore = Store.getInstance(account, mContext);
|
||||
Folder remoteFolder = remoteStore.getFolder(mailbox.mServerId);
|
||||
remoteFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
SortableMessage[] sortableMessages = new SortableMessage[0];
|
||||
if (searchParams.mOffset == 0) {
|
||||
|
@ -781,7 +781,7 @@ public class MessagingController implements Runnable {
|
|||
}
|
||||
|
||||
// 3, Open the remote folder. This pre-loads certain metadata like message count.
|
||||
remoteFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// 4. Trash any remote messages that are marked as trashed locally.
|
||||
// TODO - this comment was here, but no code was here.
|
||||
|
@ -1450,7 +1450,7 @@ public class MessagingController implements Runnable {
|
|||
if (!remoteFolder.exists()) {
|
||||
return;
|
||||
}
|
||||
remoteFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteFolder.open(OpenMode.READ_WRITE);
|
||||
if (remoteFolder.getMode() != OpenMode.READ_WRITE) {
|
||||
return;
|
||||
}
|
||||
|
@ -1560,7 +1560,7 @@ public class MessagingController implements Runnable {
|
|||
return;
|
||||
}
|
||||
|
||||
remoteFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteFolder.open(OpenMode.READ_WRITE);
|
||||
if (remoteFolder.getMode() != OpenMode.READ_WRITE) {
|
||||
remoteFolder.close(false);
|
||||
return;
|
||||
|
@ -1588,7 +1588,7 @@ public class MessagingController implements Runnable {
|
|||
/*
|
||||
* Because remoteTrashFolder may be new, we need to explicitly open it
|
||||
*/
|
||||
remoteTrashFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteTrashFolder.open(OpenMode.READ_WRITE);
|
||||
if (remoteTrashFolder.getMode() != OpenMode.READ_WRITE) {
|
||||
remoteFolder.close(false);
|
||||
remoteTrashFolder.close(false);
|
||||
|
@ -1646,7 +1646,7 @@ public class MessagingController implements Runnable {
|
|||
return;
|
||||
}
|
||||
|
||||
remoteTrashFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteTrashFolder.open(OpenMode.READ_WRITE);
|
||||
if (remoteTrashFolder.getMode() != OpenMode.READ_WRITE) {
|
||||
remoteTrashFolder.close(false);
|
||||
return;
|
||||
|
@ -1705,7 +1705,7 @@ public class MessagingController implements Runnable {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
remoteFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteFolder.open(OpenMode.READ_WRITE);
|
||||
if (remoteFolder.getMode() != OpenMode.READ_WRITE) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1838,7 +1838,7 @@ public class MessagingController implements Runnable {
|
|||
remoteServerId = message.mProtocolSearchInfo;
|
||||
}
|
||||
Folder remoteFolder = remoteStore.getFolder(remoteServerId);
|
||||
remoteFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// 3. Set up to download the entire message
|
||||
Message remoteMessage = remoteFolder.getMessage(remoteServerId);
|
||||
|
@ -1904,7 +1904,7 @@ public class MessagingController implements Runnable {
|
|||
|
||||
Store remoteStore = Store.getInstance(account, mContext);
|
||||
Folder remoteFolder = remoteStore.getFolder(mailbox.mServerId);
|
||||
remoteFolder.open(OpenMode.READ_WRITE, null);
|
||||
remoteFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// 3. Generate a shell message in which to retrieve the attachment,
|
||||
// and a shell BodyPart for the attachment. Then glue them together.
|
||||
|
|
|
@ -90,8 +90,7 @@ public abstract class Store {
|
|||
Class<?> c = Class.forName(className);
|
||||
// and invoke "newInstance" class method and instantiate store object.
|
||||
java.lang.reflect.Method m =
|
||||
c.getMethod("newInstance", Account.class, Context.class,
|
||||
PersistentDataCallbacks.class);
|
||||
c.getMethod("newInstance", Account.class, Context.class);
|
||||
// TODO Do the stores _really need a context? Is there a way to not pass it along?
|
||||
o = m.invoke(null, account, context);
|
||||
} catch (Exception e) {
|
||||
|
@ -255,37 +254,6 @@ public abstract class Store {
|
|||
public void delete() throws MessagingException {
|
||||
}
|
||||
|
||||
/**
|
||||
* If a Store intends to implement callbacks, it should be prepared to update them
|
||||
* via overriding this method. They may not be available at creation time (in which case they
|
||||
* will be passed in as null.
|
||||
* @param callbacks The updated provider of store callbacks
|
||||
*/
|
||||
protected void setPersistentDataCallbacks(PersistentDataCallbacks callbacks) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback interface by which a Store can read and write persistent data.
|
||||
* TODO This needs to be made more generic & flexible
|
||||
*/
|
||||
public interface PersistentDataCallbacks {
|
||||
|
||||
/**
|
||||
* Provides a small place for Stores to store persistent data.
|
||||
* @param key identifier for the data (e.g. "sync.key" or "folder.id")
|
||||
* @param value The data to persist. All data must be encoded into a string,
|
||||
* so use base64 or some other encoding if necessary.
|
||||
*/
|
||||
public void setPersistentString(String key, String value);
|
||||
|
||||
/**
|
||||
* @param key identifier for the data (e.g. "sync.key" or "folder.id")
|
||||
* @param defaultValue The data to return if no data was ever saved for this store
|
||||
* @return the data saved by the Store, or null if never set.
|
||||
*/
|
||||
public String getPersistentString(String key, String defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle discovery of account settings using only the user's email address and password
|
||||
* @param context the context of the caller
|
||||
|
|
|
@ -88,7 +88,7 @@ class ImapFolder extends Folder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void open(OpenMode mode, PersistentDataCallbacks callbacks)
|
||||
public void open(OpenMode mode)
|
||||
throws MessagingException {
|
||||
try {
|
||||
if (isOpen()) {
|
||||
|
@ -303,7 +303,7 @@ class ImapFolder extends Folder {
|
|||
ImapFolder newFolder = (ImapFolder)folder;
|
||||
try {
|
||||
// Temporarily select the destination folder
|
||||
newFolder.open(OpenMode.READ_WRITE, null);
|
||||
newFolder.open(OpenMode.READ_WRITE);
|
||||
// Do the search(es) ...
|
||||
for (Message m : messages) {
|
||||
String searchString = "HEADER Message-Id \"" + m.getMessageId() + "\"";
|
||||
|
|
|
@ -99,7 +99,7 @@ public class ImapStore extends Store {
|
|||
|
||||
/**
|
||||
* Creates a new store for the given account. Always use
|
||||
* {@link #newInstance(Account, Context, PersistentDataCallbacks)} to create an IMAP store.
|
||||
* {@link #newInstance(Account, Context)} to create an IMAP store.
|
||||
*/
|
||||
private ImapStore(Context context, Account account) throws MessagingException {
|
||||
mContext = context;
|
||||
|
|
|
@ -179,7 +179,7 @@ public class Pop3Store extends Store {
|
|||
folder.close(false);
|
||||
}
|
||||
try {
|
||||
folder.open(OpenMode.READ_WRITE, null);
|
||||
folder.open(OpenMode.READ_WRITE);
|
||||
bundle = folder.checkSettings();
|
||||
} finally {
|
||||
folder.close(false); // false == don't expunge anything
|
||||
|
@ -240,8 +240,7 @@ public class Pop3Store extends Store {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void open(OpenMode mode, PersistentDataCallbacks callbacks)
|
||||
throws MessagingException {
|
||||
public synchronized void open(OpenMode mode) throws MessagingException {
|
||||
if (mTransport.isOpen()) {
|
||||
return;
|
||||
}
|
||||
|
@ -909,7 +908,7 @@ public class Pop3Store extends Store {
|
|||
*/
|
||||
private String executeSensitiveCommand(String command, String sensitiveReplacement)
|
||||
throws IOException, MessagingException {
|
||||
open(OpenMode.READ_WRITE, null);
|
||||
open(OpenMode.READ_WRITE);
|
||||
|
||||
if (command != null) {
|
||||
mTransport.writeLine(command, sensitiveReplacement);
|
||||
|
|
|
@ -179,7 +179,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
|
||||
// try to open it
|
||||
setupOpenFolder(mockTransport);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// TODO: inject specific facts in the initial folder SELECT and check them here
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
getNextTag(true) + " oK [" + "rEAD-wRITE" + "] " +
|
||||
FOLDER_ENCODED + " selected. (Success)"});
|
||||
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
assertTrue(mockTransport.isTlsStarted());
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
" \"os\" \"sunos\" \"os-version\" \"5.5\"" +
|
||||
" \"support-url\" \"mailto:cyrus-bugs+@andrew.cmu.edu\")",
|
||||
"oK"}, "rEAD-wRITE");
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -428,7 +428,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
setupOpenFolder(mockTransport, new String[] {
|
||||
"* iD nIL",
|
||||
"oK [iD] bad-char-%"}, "rEAD-wRITE");
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -440,7 +440,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
// try to open it
|
||||
setupOpenFolder(mockTransport, new String[] {
|
||||
"bAD unknown command bad-char-%"}, "rEAD-wRITE");
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -453,7 +453,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
|
||||
// try to open it
|
||||
setupOpenFolder(mockTransport, null, "rEAD-wRITE");
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -471,7 +471,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
"* ID( \"name\" \"Godaddy IMAP\" \"version\" \"3.1.0\")",
|
||||
"oK"}, "rEAD-wRITE");
|
||||
try {
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
fail("Expected MessagingException");
|
||||
} catch (MessagingException expected) {
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
|
||||
// Now open the folder. Although the server indicates ID in the capabilities,
|
||||
// we are not expecting the store to send the ID command (to this particular server).
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -720,7 +720,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testReadWrite() throws MessagingException {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock, "rEAD-WRITE");
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
assertEquals(OpenMode.READ_WRITE, mFolder.getMode());
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testReadOnly() throws MessagingException {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock, "rEAD-ONLY");
|
||||
mFolder.open(OpenMode.READ_ONLY, null);
|
||||
mFolder.open(OpenMode.READ_ONLY);
|
||||
assertEquals(OpenMode.READ_ONLY, mFolder.getMode());
|
||||
}
|
||||
|
||||
|
@ -746,7 +746,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
new String[] {
|
||||
"* sTATUS \"" + FOLDER_ENCODED + "\" (uNSEEN 2)",
|
||||
getNextTag(true) + " oK STATUS completed"});
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
int unreadCount = mFolder.getUnreadMessageCount();
|
||||
assertEquals("getUnreadMessageCount with quoted string", 2, unreadCount);
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
"* sTATUS {5}",
|
||||
FOLDER_ENCODED + " (uNSEEN 10)",
|
||||
getNextTag(true) + " oK STATUS completed"});
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
int unreadCount = mFolder.getUnreadMessageCount();
|
||||
assertEquals("getUnreadMessageCount with literal string", 10, unreadCount);
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testFetchFlagEnvelope() throws MessagingException {
|
||||
final MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
final Message message = mFolder.createMessage("1");
|
||||
|
||||
final FetchProfile fp = new FetchProfile();
|
||||
|
@ -812,7 +812,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testFetchBodyStructureSimple() throws Exception {
|
||||
final MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
final Message message = mFolder.createMessage("1");
|
||||
|
||||
final FetchProfile fp = new FetchProfile();
|
||||
|
@ -851,7 +851,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testFetchBodyStructureMultipart() throws Exception {
|
||||
final MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
final Message message = mFolder.createMessage("1");
|
||||
|
||||
final FetchProfile fp = new FetchProfile();
|
||||
|
@ -973,7 +973,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testFetchBodySane() throws MessagingException {
|
||||
final MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
final Message message = mFolder.createMessage("1");
|
||||
|
||||
final FetchProfile fp = new FetchProfile();
|
||||
|
@ -996,7 +996,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testFetchBody() throws MessagingException {
|
||||
final MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
final Message message = mFolder.createMessage("1");
|
||||
|
||||
final FetchProfile fp = new FetchProfile();
|
||||
|
@ -1019,7 +1019,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testFetchAttachment() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
final Message message = mFolder.createMessage("1");
|
||||
|
||||
final FetchProfile fp = new FetchProfile();
|
||||
|
@ -1069,7 +1069,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testNilMessage() throws MessagingException {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// Prepare to pull structure and peek body text - this is like the "large message"
|
||||
// loop in MessagingController.synchronizeMailboxGeneric()
|
||||
|
@ -1126,7 +1126,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testExcessFetchResult() throws MessagingException {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// Create a message, and make sure it's not "SEEN".
|
||||
Message message1 = mFolder.createMessage("1");
|
||||
|
@ -1187,7 +1187,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testAppendMessages() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
ImapMessage message = prepareForAppendTest(mock, "oK [aPPENDUID 1234567 13] (Success)");
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testAppendMessagesNoAppendUid() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
ImapMessage message = prepareForAppendTest(mock, "OK Success");
|
||||
|
||||
|
@ -1237,7 +1237,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testAppendFailure() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
ImapMessage message = prepareForAppendTest(mock, "NO No space left on the server.");
|
||||
assertEquals("initial uid", message.getUid());
|
||||
|
@ -1461,7 +1461,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
getNextTag(true) + " nO no such mailbox"
|
||||
});
|
||||
try {
|
||||
folder.open(OpenMode.READ_WRITE, null);
|
||||
folder.open(OpenMode.READ_WRITE);
|
||||
fail();
|
||||
} catch (MessagingException expected) {
|
||||
}
|
||||
|
@ -1474,7 +1474,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
getNextTag(true) + " oK [rEAD-wRITE]"
|
||||
});
|
||||
|
||||
folder.open(OpenMode.READ_WRITE, null);
|
||||
folder.open(OpenMode.READ_WRITE);
|
||||
assertTrue(folder.exists());
|
||||
assertEquals(1, folder.getMessageCount());
|
||||
assertEquals(OpenMode.READ_WRITE, folder.getMode());
|
||||
|
@ -1491,7 +1491,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
getNextTag(true) + " oK [rEAD-oNLY]"
|
||||
});
|
||||
|
||||
folder.open(OpenMode.READ_WRITE, null);
|
||||
folder.open(OpenMode.READ_WRITE);
|
||||
assertTrue(folder.exists());
|
||||
assertEquals(2, folder.getMessageCount());
|
||||
assertEquals(OpenMode.READ_ONLY, folder.getMode());
|
||||
|
@ -1504,7 +1504,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
getNextTag(true) + " oK selected"
|
||||
});
|
||||
|
||||
folder.open(OpenMode.READ_WRITE, null);
|
||||
folder.open(OpenMode.READ_WRITE);
|
||||
assertTrue(folder.exists());
|
||||
assertEquals(15, folder.getMessageCount());
|
||||
assertEquals(OpenMode.READ_WRITE, folder.getMode());
|
||||
|
@ -1568,7 +1568,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
private void setupCopyMessages(boolean withUidPlus) throws Exception {
|
||||
mCopyMock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mCopyMock, new String[] {"* iD nIL", "oK"}, "rEAD-wRITE", withUidPlus);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
mCopyToFolder = mStore.getFolder("\u65E5\u672C\u8A9E");
|
||||
Message m1 = mFolder.createMessage("11");
|
||||
|
@ -1797,7 +1797,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testGetUnreadMessageCount() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
mock.expect(getNextTag(false) + " STATUS \\\"" + FOLDER_ENCODED + "\\\" \\(UNSEEN\\)",
|
||||
new String[] {
|
||||
|
@ -1811,7 +1811,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testExpunge() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
mock.expect(getNextTag(false) + " EXPUNGE",
|
||||
new String[] {
|
||||
|
@ -1826,7 +1826,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testSetFlags() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
Message[] messages = new Message[] {
|
||||
mFolder.createMessage("11"),
|
||||
|
@ -1855,7 +1855,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testSearchForUids() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// Single results
|
||||
mock.expect(
|
||||
|
@ -1916,7 +1916,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testGetMessage() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// Found
|
||||
mock.expect(
|
||||
|
@ -1940,7 +1940,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testGetMessages1() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// Found
|
||||
mock.expect(
|
||||
|
@ -1969,7 +1969,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testGetMessages2() throws Exception {
|
||||
MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
// No command will be sent
|
||||
checkMessageUids(new String[] {"3", "4", "5"},
|
||||
|
@ -2098,7 +2098,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
"* OK [UIDNEXT 449625]",
|
||||
"* NO [ALERT] Mailbox is at 98% of quota",
|
||||
getNextTag(true) + " OK [READ-WRITE] Completed"});
|
||||
folder.open(OpenMode.READ_WRITE, null); // shouldn't crash.
|
||||
folder.open(OpenMode.READ_WRITE); // shouldn't crash.
|
||||
assertEquals(6406, folder.getMessageCount());
|
||||
}
|
||||
|
||||
|
@ -2108,7 +2108,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void testFetchBodyStructureMalformed() throws Exception {
|
||||
final MockTransport mock = openAndInjectMockTransport();
|
||||
setupOpenFolder(mock);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
final Message message = mFolder.createMessage("1");
|
||||
|
||||
final FetchProfile fp = new FetchProfile();
|
||||
|
@ -2176,7 +2176,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
"* OK [UNSEEN 0]",
|
||||
"* OK [UIDNEXT 1]",
|
||||
getNextTag(true) + " OK [READ-WRITE] " + FOLDER_1});
|
||||
folders[2].open(OpenMode.READ_WRITE, null);
|
||||
folders[2].open(OpenMode.READ_WRITE);
|
||||
folders[2].close(false);
|
||||
|
||||
expectNoop(mock, true);
|
||||
|
@ -2188,7 +2188,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
"* OK [UNSEEN 0]",
|
||||
"* OK [UIDNEXT 1]",
|
||||
getNextTag(true) + " OK [READ-WRITE] " + FOLDER_2});
|
||||
folders[1].open(OpenMode.READ_WRITE, null);
|
||||
folders[1].open(OpenMode.READ_WRITE);
|
||||
folders[1].close(false);
|
||||
}
|
||||
|
||||
|
@ -2209,7 +2209,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
try {
|
||||
final MockTransport mockTransport = openAndInjectMockTransport();
|
||||
setupOpenFolder(mockTransport);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
|
||||
target.run(mockTransport);
|
||||
|
||||
|
@ -2304,7 +2304,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
|
|||
public void run(MockTransport mockTransport) throws Exception {
|
||||
mockTransport.expectIOException();
|
||||
final Folder folder = mStore.getFolder("test");
|
||||
folder.open(OpenMode.READ_WRITE, null);
|
||||
folder.open(OpenMode.READ_WRITE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public class Pop3StoreUnitTests extends InstrumentationTestCase {
|
|||
|
||||
// try to open it
|
||||
setupOpenFolder(mockTransport, 0, null);
|
||||
mFolder.open(OpenMode.READ_ONLY, null);
|
||||
mFolder.open(OpenMode.READ_ONLY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,7 +226,7 @@ public class Pop3StoreUnitTests extends InstrumentationTestCase {
|
|||
// And watch it fail
|
||||
try {
|
||||
Pop3Store.Pop3Folder folder = mStore.new Pop3Folder("INBOX");
|
||||
folder.open(OpenMode.READ_WRITE, null);
|
||||
folder.open(OpenMode.READ_WRITE);
|
||||
fail("Should have thrown exception");
|
||||
} catch (MessagingException me) {
|
||||
// Expected - continue.
|
||||
|
@ -344,7 +344,7 @@ public class Pop3StoreUnitTests extends InstrumentationTestCase {
|
|||
MockTransport mockTransport = openAndInjectMockTransport();
|
||||
|
||||
setupOpenFolder(mockTransport, 2, null);
|
||||
mFolder.open(OpenMode.READ_WRITE, null);
|
||||
mFolder.open(OpenMode.READ_WRITE);
|
||||
// check message count
|
||||
assertEquals(2, mFolder.getMessageCount());
|
||||
|
||||
|
@ -468,7 +468,7 @@ public class Pop3StoreUnitTests extends InstrumentationTestCase {
|
|||
|
||||
// openFolderWithMessage(mockTransport);
|
||||
setupOpenFolder(mockTransport, 6000, null);
|
||||
mFolder.open(OpenMode.READ_ONLY, null);
|
||||
mFolder.open(OpenMode.READ_ONLY);
|
||||
assertEquals(6000, mFolder.getMessageCount());
|
||||
|
||||
// index the message(s) - it should fail, because our stream is broken
|
||||
|
@ -731,7 +731,7 @@ public class Pop3StoreUnitTests extends InstrumentationTestCase {
|
|||
// like openFolderWithMessage(mockTransport) but with a broken STAT report (empty response)
|
||||
setupOpenFolder(mockTransport, -1, null);
|
||||
try {
|
||||
mFolder.open(OpenMode.READ_ONLY, null);
|
||||
mFolder.open(OpenMode.READ_ONLY);
|
||||
fail("Broken STAT should cause open() to throw.");
|
||||
} catch(MessagingException me) {
|
||||
// success
|
||||
|
@ -874,7 +874,7 @@ public class Pop3StoreUnitTests extends InstrumentationTestCase {
|
|||
private void openFolderWithMessage(MockTransport mockTransport) throws MessagingException {
|
||||
// try to open it
|
||||
setupOpenFolder(mockTransport, 1, null);
|
||||
mFolder.open(OpenMode.READ_ONLY, null);
|
||||
mFolder.open(OpenMode.READ_ONLY);
|
||||
|
||||
// check message count
|
||||
assertEquals(1, mFolder.getMessageCount());
|
||||
|
|
|
@ -108,7 +108,7 @@ public class MockFolder extends Folder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void open(OpenMode mode, PersistentDataCallbacks callbacks) {
|
||||
public void open(OpenMode mode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue